@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | // check if the file is stored in the array cache, this means that we |
369 | 369 | // copy a file over to the versions folder, in this case we don't want to |
370 | 370 | // decrypt it |
371 | - if ($this->arrayCache->hasKey('encryption_copy_version_' . $path)) { |
|
372 | - $this->arrayCache->remove('encryption_copy_version_' . $path); |
|
371 | + if ($this->arrayCache->hasKey('encryption_copy_version_'.$path)) { |
|
372 | + $this->arrayCache->remove('encryption_copy_version_'.$path); |
|
373 | 373 | return $this->storage->fopen($path, $mode); |
374 | 374 | } |
375 | 375 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | } |
441 | 441 | } catch (ModuleDoesNotExistsException $e) { |
442 | 442 | $this->logger->logException($e, [ |
443 | - 'message' => 'Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted', |
|
443 | + 'message' => 'Encryption module "'.$encryptionModuleId.'" not found, file will be stored unencrypted', |
|
444 | 444 | 'level' => ILogger::WARN, |
445 | 445 | 'app' => 'core', |
446 | 446 | ]); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | try { |
496 | 496 | $result = $this->fixUnencryptedSize($path, $size, $unencryptedSize); |
497 | 497 | } catch (\Exception $e) { |
498 | - $this->logger->error('Couldn\'t re-calculate unencrypted size for '. $path); |
|
498 | + $this->logger->error('Couldn\'t re-calculate unencrypted size for '.$path); |
|
499 | 499 | $this->logger->logException($e); |
500 | 500 | } |
501 | 501 | unset($this->fixUnencryptedSizeOf[$this->getFullPath($path)]); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | |
525 | 525 | // if we couldn't open the file we return the old unencrypted size |
526 | 526 | if (!is_resource($stream)) { |
527 | - $this->logger->error('Could not open ' . $path . '. Recalculation of unencrypted size aborted.'); |
|
527 | + $this->logger->error('Could not open '.$path.'. Recalculation of unencrypted size aborted.'); |
|
528 | 528 | return $unencryptedSize; |
529 | 529 | } |
530 | 530 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | // next highest is end of chunks, one subtracted is last one |
550 | 550 | // we have to read the last chunk, we can't just calculate it (because of padding etc) |
551 | 551 | |
552 | - $lastChunkNr = ceil($size/ $blockSize)-1; |
|
552 | + $lastChunkNr = ceil($size / $blockSize) - 1; |
|
553 | 553 | // calculate last chunk position |
554 | 554 | $lastChunkPos = ($lastChunkNr * $blockSize); |
555 | 555 | // try to fseek to the last chunk, if it fails we have to read the whole file |
@@ -557,16 +557,16 @@ discard block |
||
557 | 557 | $newUnencryptedSize += $lastChunkNr * $unencryptedBlockSize; |
558 | 558 | } |
559 | 559 | |
560 | - $lastChunkContentEncrypted=''; |
|
560 | + $lastChunkContentEncrypted = ''; |
|
561 | 561 | $count = $blockSize; |
562 | 562 | |
563 | 563 | while ($count > 0) { |
564 | - $data=fread($stream, $blockSize); |
|
565 | - $count=strlen($data); |
|
564 | + $data = fread($stream, $blockSize); |
|
565 | + $count = strlen($data); |
|
566 | 566 | $lastChunkContentEncrypted .= $data; |
567 | - if(strlen($lastChunkContentEncrypted) > $blockSize) { |
|
567 | + if (strlen($lastChunkContentEncrypted) > $blockSize) { |
|
568 | 568 | $newUnencryptedSize += $unencryptedBlockSize; |
569 | - $lastChunkContentEncrypted=substr($lastChunkContentEncrypted, $blockSize); |
|
569 | + $lastChunkContentEncrypted = substr($lastChunkContentEncrypted, $blockSize); |
|
570 | 570 | } |
571 | 571 | } |
572 | 572 | |
@@ -574,8 +574,8 @@ discard block |
||
574 | 574 | |
575 | 575 | // we have to decrypt the last chunk to get it actual size |
576 | 576 | $encryptionModule->begin($this->getFullPath($path), $this->uid, 'r', $header, []); |
577 | - $decryptedLastChunk = $encryptionModule->decrypt($lastChunkContentEncrypted, $lastChunkNr . 'end'); |
|
578 | - $decryptedLastChunk .= $encryptionModule->end($this->getFullPath($path), $lastChunkNr . 'end'); |
|
577 | + $decryptedLastChunk = $encryptionModule->decrypt($lastChunkContentEncrypted, $lastChunkNr.'end'); |
|
578 | + $decryptedLastChunk .= $encryptionModule->end($this->getFullPath($path), $lastChunkNr.'end'); |
|
579 | 579 | |
580 | 580 | // calc the real file size with the size of the last chunk |
581 | 581 | $newUnencryptedSize += strlen($decryptedLastChunk); |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | $cacheInformation = [ |
660 | 660 | 'encrypted' => $isEncrypted, |
661 | 661 | ]; |
662 | - if($isEncrypted) { |
|
662 | + if ($isEncrypted) { |
|
663 | 663 | $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion']; |
664 | 664 | |
665 | 665 | // In case of a move operation from an unencrypted to an encrypted |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | // correct value would be "1". Thus we manually set the value to "1" |
668 | 668 | // for those cases. |
669 | 669 | // See also https://github.com/owncloud/core/issues/23078 |
670 | - if($encryptedVersion === 0 || !$keepEncryptionVersion) { |
|
670 | + if ($encryptedVersion === 0 || !$keepEncryptionVersion) { |
|
671 | 671 | $encryptedVersion = 1; |
672 | 672 | } |
673 | 673 | |
@@ -703,9 +703,9 @@ discard block |
||
703 | 703 | // remember that we try to create a version so that we can detect it during |
704 | 704 | // fopen($sourceInternalPath) and by-pass the encryption in order to |
705 | 705 | // create a 1:1 copy of the file |
706 | - $this->arrayCache->set('encryption_copy_version_' . $sourceInternalPath, true); |
|
706 | + $this->arrayCache->set('encryption_copy_version_'.$sourceInternalPath, true); |
|
707 | 707 | $result = $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath); |
708 | - $this->arrayCache->remove('encryption_copy_version_' . $sourceInternalPath); |
|
708 | + $this->arrayCache->remove('encryption_copy_version_'.$sourceInternalPath); |
|
709 | 709 | if ($result) { |
710 | 710 | $info = $this->getCache('', $sourceStorage)->get($sourceInternalPath); |
711 | 711 | // make sure that we update the unencrypted size for the version |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | $mount = $this->mountManager->findByStorageId($sourceStorage->getId()); |
726 | 726 | if (count($mount) === 1) { |
727 | 727 | $mountPoint = $mount[0]->getMountPoint(); |
728 | - $source = $mountPoint . '/' . $sourceInternalPath; |
|
728 | + $source = $mountPoint.'/'.$sourceInternalPath; |
|
729 | 729 | $target = $this->getFullPath($targetInternalPath); |
730 | 730 | $this->copyKeys($source, $target); |
731 | 731 | } else { |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | if (is_resource($dh)) { |
739 | 739 | while ($result and ($file = readdir($dh)) !== false) { |
740 | 740 | if (!Filesystem::isIgnoredDir($file)) { |
741 | - $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file, false, $isRename); |
|
741 | + $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file, false, $isRename); |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | fclose($target); |
755 | 755 | throw $e; |
756 | 756 | } |
757 | - if($result) { |
|
757 | + if ($result) { |
|
758 | 758 | if ($preserveMtime) { |
759 | 759 | $this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath)); |
760 | 760 | } |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | $this->getCache()->remove($targetInternalPath); |
767 | 767 | } |
768 | 768 | } |
769 | - return (bool)$result; |
|
769 | + return (bool) $result; |
|
770 | 770 | |
771 | 771 | } |
772 | 772 | |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * @return string full path including mount point |
838 | 838 | */ |
839 | 839 | protected function getFullPath($path) { |
840 | - return Filesystem::normalizePath($this->mountPoint . '/' . $path); |
|
840 | + return Filesystem::normalizePath($this->mountPoint.'/'.$path); |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | /** |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $header = substr($header, 0, $endAt + strlen(Util::HEADER_END)); |
894 | 894 | |
895 | 895 | // +1 to not start with an ':' which would result in empty element at the beginning |
896 | - $exploded = explode(':', substr($header, strlen(Util::HEADER_START)+1)); |
|
896 | + $exploded = explode(':', substr($header, strlen(Util::HEADER_START) + 1)); |
|
897 | 897 | |
898 | 898 | $element = array_shift($exploded); |
899 | 899 | while ($element !== Util::HEADER_END) { |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | try { |
957 | 957 | $encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId); |
958 | 958 | } catch (ModuleDoesNotExistsException $e) { |
959 | - $this->logger->critical('Encryption module defined in "' . $path . '" not loaded!'); |
|
959 | + $this->logger->critical('Encryption module defined in "'.$path.'" not loaded!'); |
|
960 | 960 | throw $e; |
961 | 961 | } |
962 | 962 | } |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | use Icewind\Streams\CallbackWrapper; |
34 | 34 | use OCP\ILogger; |
35 | 35 | |
36 | -class ZIP extends Archive{ |
|
36 | +class ZIP extends Archive { |
|
37 | 37 | /** |
38 | 38 | * @var \ZipArchive zip |
39 | 39 | */ |
40 | - private $zip=null; |
|
40 | + private $zip = null; |
|
41 | 41 | private $path; |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @param string $source |
45 | 45 | */ |
46 | 46 | public function __construct($source) { |
47 | - $this->path=$source; |
|
48 | - $this->zip=new \ZipArchive(); |
|
49 | - if($this->zip->open($source, \ZipArchive::CREATE)) { |
|
50 | - }else{ |
|
47 | + $this->path = $source; |
|
48 | + $this->zip = new \ZipArchive(); |
|
49 | + if ($this->zip->open($source, \ZipArchive::CREATE)) { |
|
50 | + } else { |
|
51 | 51 | \OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN); |
52 | 52 | } |
53 | 53 | } |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | * @param string $source either a local file or string data |
66 | 66 | * @return bool |
67 | 67 | */ |
68 | - public function addFile($path, $source='') { |
|
69 | - if($source and $source[0]=='/' and file_exists($source)) { |
|
70 | - $result=$this->zip->addFile($source, $path); |
|
71 | - }else{ |
|
72 | - $result=$this->zip->addFromString($path, $source); |
|
68 | + public function addFile($path, $source = '') { |
|
69 | + if ($source and $source[0] == '/' and file_exists($source)) { |
|
70 | + $result = $this->zip->addFile($source, $path); |
|
71 | + } else { |
|
72 | + $result = $this->zip->addFromString($path, $source); |
|
73 | 73 | } |
74 | - if($result) { |
|
75 | - $this->zip->close();//close and reopen to save the zip |
|
74 | + if ($result) { |
|
75 | + $this->zip->close(); //close and reopen to save the zip |
|
76 | 76 | $this->zip->open($this->path); |
77 | 77 | } |
78 | 78 | return $result; |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @return boolean|null |
85 | 85 | */ |
86 | 86 | public function rename($source, $dest) { |
87 | - $source=$this->stripPath($source); |
|
88 | - $dest=$this->stripPath($dest); |
|
87 | + $source = $this->stripPath($source); |
|
88 | + $dest = $this->stripPath($dest); |
|
89 | 89 | $this->zip->renameName($source, $dest); |
90 | 90 | } |
91 | 91 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return int |
95 | 95 | */ |
96 | 96 | public function filesize($path) { |
97 | - $stat=$this->zip->statName($path); |
|
97 | + $stat = $this->zip->statName($path); |
|
98 | 98 | return $stat['size']; |
99 | 99 | } |
100 | 100 | /** |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | * @return array |
112 | 112 | */ |
113 | 113 | public function getFolder($path) { |
114 | - $files=$this->getFiles(); |
|
115 | - $folderContent=array(); |
|
116 | - $pathLength=strlen($path); |
|
117 | - foreach($files as $file) { |
|
118 | - if(substr($file, 0, $pathLength)==$path and $file!=$path) { |
|
119 | - if(strrpos(substr($file, 0, -1), '/')<=$pathLength) { |
|
120 | - $folderContent[]=substr($file, $pathLength); |
|
114 | + $files = $this->getFiles(); |
|
115 | + $folderContent = array(); |
|
116 | + $pathLength = strlen($path); |
|
117 | + foreach ($files as $file) { |
|
118 | + if (substr($file, 0, $pathLength) == $path and $file != $path) { |
|
119 | + if (strrpos(substr($file, 0, -1), '/') <= $pathLength) { |
|
120 | + $folderContent[] = substr($file, $pathLength); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | * @return array |
129 | 129 | */ |
130 | 130 | public function getFiles() { |
131 | - $fileCount=$this->zip->numFiles; |
|
132 | - $files=array(); |
|
133 | - for($i=0;$i<$fileCount;$i++) { |
|
134 | - $files[]=$this->zip->getNameIndex($i); |
|
131 | + $fileCount = $this->zip->numFiles; |
|
132 | + $files = array(); |
|
133 | + for ($i = 0; $i < $fileCount; $i++) { |
|
134 | + $files[] = $this->zip->getNameIndex($i); |
|
135 | 135 | } |
136 | 136 | return $files; |
137 | 137 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @return bool |
168 | 168 | */ |
169 | 169 | public function fileExists($path) { |
170 | - return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false); |
|
170 | + return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false); |
|
171 | 171 | } |
172 | 172 | /** |
173 | 173 | * remove a file or folder from the archive |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | * @return bool |
176 | 176 | */ |
177 | 177 | public function remove($path) { |
178 | - if($this->fileExists($path.'/')) { |
|
178 | + if ($this->fileExists($path.'/')) { |
|
179 | 179 | return $this->zip->deleteName($path.'/'); |
180 | - }else{ |
|
180 | + } else { |
|
181 | 181 | return $this->zip->deleteName($path); |
182 | 182 | } |
183 | 183 | } |
@@ -188,23 +188,23 @@ discard block |
||
188 | 188 | * @return resource |
189 | 189 | */ |
190 | 190 | public function getStream($path, $mode) { |
191 | - if($mode=='r' or $mode=='rb') { |
|
191 | + if ($mode == 'r' or $mode == 'rb') { |
|
192 | 192 | return $this->zip->getStream($path); |
193 | 193 | } else { |
194 | 194 | //since we can't directly get a writable stream, |
195 | 195 | //make a temp copy of the file and put it back |
196 | 196 | //in the archive when the stream is closed |
197 | - if(strrpos($path, '.')!==false) { |
|
198 | - $ext=substr($path, strrpos($path, '.')); |
|
199 | - }else{ |
|
200 | - $ext=''; |
|
197 | + if (strrpos($path, '.') !== false) { |
|
198 | + $ext = substr($path, strrpos($path, '.')); |
|
199 | + } else { |
|
200 | + $ext = ''; |
|
201 | 201 | } |
202 | 202 | $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); |
203 | - if($this->fileExists($path)) { |
|
203 | + if ($this->fileExists($path)) { |
|
204 | 204 | $this->extractFile($path, $tmpFile); |
205 | 205 | } |
206 | 206 | $handle = fopen($tmpFile, $mode); |
207 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
207 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
208 | 208 | $this->writeBack($tmpFile, $path); |
209 | 209 | }); |
210 | 210 | } |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | * @return string |
224 | 224 | */ |
225 | 225 | private function stripPath($path) { |
226 | - if(!$path || $path[0]=='/') { |
|
226 | + if (!$path || $path[0] == '/') { |
|
227 | 227 | return substr($path, 1); |
228 | - }else{ |
|
228 | + } else { |
|
229 | 229 | return $path; |
230 | 230 | } |
231 | 231 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $rootView = new View(); |
54 | 54 | $user = \OC::$server->getUserSession()->getUser(); |
55 | 55 | Filesystem::initMountPoints($user->getUID()); |
56 | - if (!$rootView->file_exists('/' . $user->getUID() . '/cache')) { |
|
57 | - $rootView->mkdir('/' . $user->getUID() . '/cache'); |
|
56 | + if (!$rootView->file_exists('/'.$user->getUID().'/cache')) { |
|
57 | + $rootView->mkdir('/'.$user->getUID().'/cache'); |
|
58 | 58 | } |
59 | - $this->storage = new View('/' . $user->getUID() . '/cache'); |
|
59 | + $this->storage = new View('/'.$user->getUID().'/cache'); |
|
60 | 60 | return $this->storage; |
61 | 61 | } else { |
62 | 62 | \OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', ILogger::ERROR); |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | // unique id to avoid chunk collision, just in case |
107 | 107 | $uniqueId = \OC::$server->getSecureRandom()->generate( |
108 | 108 | 16, |
109 | - ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER |
|
109 | + ISecureRandom::CHAR_DIGITS.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | // use part file to prevent hasKey() to find the key |
113 | 113 | // while it is being written |
114 | - $keyPart = $key . '.' . $uniqueId . '.part'; |
|
114 | + $keyPart = $key.'.'.$uniqueId.'.part'; |
|
115 | 115 | if ($storage and $storage->file_put_contents($keyPart, $value)) { |
116 | 116 | if ($ttl === 0) { |
117 | 117 | $ttl = 86400; // 60*60*24 |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if (is_resource($dh)) { |
161 | 161 | while (($file = readdir($dh)) !== false) { |
162 | 162 | if ($file != '.' and $file != '..' and ($prefix === '' || strpos($file, $prefix) === 0)) { |
163 | - $storage->unlink('/' . $file); |
|
163 | + $storage->unlink('/'.$file); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -185,17 +185,17 @@ discard block |
||
185 | 185 | while (($file = readdir($dh)) !== false) { |
186 | 186 | if ($file != '.' and $file != '..') { |
187 | 187 | try { |
188 | - $mtime = $storage->filemtime('/' . $file); |
|
188 | + $mtime = $storage->filemtime('/'.$file); |
|
189 | 189 | if ($mtime < $now) { |
190 | - $storage->unlink('/' . $file); |
|
190 | + $storage->unlink('/'.$file); |
|
191 | 191 | } |
192 | 192 | } catch (\OCP\Lock\LockedException $e) { |
193 | 193 | // ignore locked chunks |
194 | - \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core')); |
|
194 | + \OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', array('app' => 'core')); |
|
195 | 195 | } catch (\OCP\Files\ForbiddenException $e) { |
196 | - \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "' . $file . '"', array('app' => 'core')); |
|
196 | + \OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "'.$file.'"', array('app' => 'core')); |
|
197 | 197 | } catch (\OCP\Files\LockNotAcquiredException $e) { |
198 | - \OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core')); |
|
198 | + \OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', array('app' => 'core')); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
@@ -39,23 +39,23 @@ |
||
39 | 39 | /** |
40 | 40 | * @since 14.0.0 |
41 | 41 | */ |
42 | - const DEBUG=0; |
|
42 | + const DEBUG = 0; |
|
43 | 43 | /** |
44 | 44 | * @since 14.0.0 |
45 | 45 | */ |
46 | - const INFO=1; |
|
46 | + const INFO = 1; |
|
47 | 47 | /** |
48 | 48 | * @since 14.0.0 |
49 | 49 | */ |
50 | - const WARN=2; |
|
50 | + const WARN = 2; |
|
51 | 51 | /** |
52 | 52 | * @since 14.0.0 |
53 | 53 | */ |
54 | - const ERROR=3; |
|
54 | + const ERROR = 3; |
|
55 | 55 | /** |
56 | 56 | * @since 14.0.0 |
57 | 57 | */ |
58 | - const FATAL=4; |
|
58 | + const FATAL = 4; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * System is unusable. |
@@ -39,5 +39,5 @@ |
||
39 | 39 | /** |
40 | 40 | * @since 14.0.0 |
41 | 41 | */ |
42 | - public function getEntries(int $limit=50, int $offset=0): array; |
|
42 | + public function getEntries(int $limit = 50, int $offset = 0): array; |
|
43 | 43 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | protected function run($argument) { |
147 | 147 | $target = $argument['url']; |
148 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
148 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
149 | 149 | $currentTime = $this->timeFactory->getTime(); |
150 | 150 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
151 | 151 | $source = rtrim($source, '/'); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $deadline = $currentTime - $this->maxLifespan; |
156 | 156 | if ($created < $deadline) { |
157 | 157 | $this->retainJob = false; |
158 | - $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE); |
|
158 | + $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
164 | 164 | |
165 | 165 | // make sure that we have a well formatted url |
166 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
166 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
167 | 167 | |
168 | 168 | $result = null; |
169 | 169 | try { |
@@ -186,21 +186,21 @@ discard block |
||
186 | 186 | } catch (ClientException $e) { |
187 | 187 | $status = $e->getCode(); |
188 | 188 | if ($status === Http::STATUS_FORBIDDEN) { |
189 | - $this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
189 | + $this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
190 | 190 | } else { |
191 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); |
|
191 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']); |
|
192 | 192 | } |
193 | 193 | } catch (RequestException $e) { |
194 | 194 | $status = -1; // There is no status code if we could not connect |
195 | 195 | $this->logger->logException($e, [ |
196 | - 'message' => 'Could not connect to ' . $target, |
|
196 | + 'message' => 'Could not connect to '.$target, |
|
197 | 197 | 'level' => ILogger::INFO, |
198 | 198 | 'app' => 'federation', |
199 | 199 | ]); |
200 | 200 | } catch (RingException $e) { |
201 | 201 | $status = -1; // There is no status code if we could not connect |
202 | 202 | $this->logger->logException($e, [ |
203 | - 'message' => 'Could not connect to ' . $target, |
|
203 | + 'message' => 'Could not connect to '.$target, |
|
204 | 204 | 'level' => ILogger::INFO, |
205 | 205 | 'app' => 'federation', |
206 | 206 | ]); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ); |
228 | 228 | } else { |
229 | 229 | $this->logger->error( |
230 | - 'remote server "' . $target . '"" does not return a valid shared secret. Received data: ' . $body, |
|
230 | + 'remote server "'.$target.'"" does not return a valid shared secret. Received data: '.$body, |
|
231 | 231 | ['app' => 'federation'] |
232 | 232 | ); |
233 | 233 | $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | protected function reAddJob(array $argument) { |
245 | 245 | $url = $argument['url']; |
246 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
246 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
247 | 247 | $token = $argument['token']; |
248 | 248 | $this->jobList->add( |
249 | 249 | GetSharedSecret::class, |
@@ -37,10 +37,10 @@ |
||
37 | 37 | |
38 | 38 | public function run($dummy) { |
39 | 39 | $systemConfig = \OC::$server->getSystemConfig(); |
40 | - $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); |
|
40 | + $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log'); |
|
41 | 41 | |
42 | 42 | $this->maxSize = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024); |
43 | - if($this->shouldRotateBySize()) { |
|
43 | + if ($this->shouldRotateBySize()) { |
|
44 | 44 | $rotatedFile = $this->rotate(); |
45 | 45 | $msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"'; |
46 | 46 | \OC::$server->getLogger()->warning($msg, ['app' => Rotate::class]); |
@@ -59,9 +59,9 @@ |
||
59 | 59 | * @since 14.0.0 |
60 | 60 | */ |
61 | 61 | protected function shouldRotateBySize():bool { |
62 | - if ((int)$this->maxSize > 0) { |
|
62 | + if ((int) $this->maxSize > 0) { |
|
63 | 63 | $filesize = @filesize($this->filePath); |
64 | - if ($filesize >= (int)$this->maxSize) { |
|
64 | + if ($filesize >= (int) $this->maxSize) { |
|
65 | 65 | return true; |
66 | 66 | } |
67 | 67 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $c = $this->getContainer()->getServer(); |
66 | 66 | $config = $c->getConfig(); |
67 | 67 | |
68 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log'; |
|
68 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/audit.log'; |
|
69 | 69 | $logFile = $config->getAppValue('admin_audit', 'logfile', $default); |
70 | - if($logFile === null) { |
|
70 | + if ($logFile === null) { |
|
71 | 71 | $this->logger = $c->getLogger(); |
72 | 72 | return; |
73 | 73 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | protected function userManagementHooks() { |
103 | 103 | $userActions = new UserManagement($this->logger); |
104 | 104 | |
105 | - Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
106 | - Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
107 | - Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
105 | + Util::connectHook('OC_User', 'post_createUser', $userActions, 'create'); |
|
106 | + Util::connectHook('OC_User', 'post_deleteUser', $userActions, 'delete'); |
|
107 | + Util::connectHook('OC_User', 'changeUser', $userActions, 'change'); |
|
108 | 108 | |
109 | 109 | /** @var IUserSession|Session $userSession */ |
110 | 110 | $userSession = $this->getContainer()->getServer()->getUserSession(); |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $userSession->listen('\OC\User', 'postUnassignedUserId', [$userActions, 'unassign']); |
114 | 114 | } |
115 | 115 | |
116 | - protected function groupHooks() { |
|
116 | + protected function groupHooks() { |
|
117 | 117 | $groupActions = new GroupManagement($this->logger); |
118 | 118 | |
119 | 119 | /** @var IGroupManager|Manager $groupManager */ |
120 | 120 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
121 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
122 | - $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
123 | - $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
124 | - $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
121 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$groupActions, 'removeUser']); |
|
122 | + $groupManager->listen('\OC\Group', 'postAddUser', [$groupActions, 'addUser']); |
|
123 | + $groupManager->listen('\OC\Group', 'postDelete', [$groupActions, 'deleteGroup']); |
|
124 | + $groupManager->listen('\OC\Group', 'postCreate', [$groupActions, 'createGroup']); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function sharingHooks() { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | protected function versionsHooks() { |
235 | 235 | $versionsActions = new Versions($this->logger); |
236 | 236 | Util::connectHook('\OCP\Versions', 'rollback', $versionsActions, 'rollback'); |
237 | - Util::connectHook('\OCP\Versions', 'delete',$versionsActions, 'delete'); |
|
237 | + Util::connectHook('\OCP\Versions', 'delete', $versionsActions, 'delete'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | protected function trashbinHooks() { |