@@ -99,7 +99,7 @@ |
||
99 | 99 | $user = $this->userSession->getUser()->getUID(); |
100 | 100 | |
101 | 101 | $mounts = \OC_Mount_Config::getAbsoluteMountPoints($user); |
102 | - foreach($mounts as $mountPoint => $mount) { |
|
102 | + foreach ($mounts as $mountPoint => $mount) { |
|
103 | 103 | $entries[] = $this->formatMount($mountPoint, $mount); |
104 | 104 | } |
105 | 105 |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // interpolate $message as defined in PSR-3 |
211 | 211 | $replace = []; |
212 | 212 | foreach ($context as $key => $val) { |
213 | - $replace['{' . $key . '}'] = $val; |
|
213 | + $replace['{'.$key.'}'] = $val; |
|
214 | 214 | } |
215 | 215 | $message = strtr($message, $replace); |
216 | 216 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | public function getLogPath():string { |
320 | - if($this->logger instanceof IFileBased) { |
|
320 | + if ($this->logger instanceof IFileBased) { |
|
321 | 321 | return $this->logger->getLogFilePath(); |
322 | 322 | } |
323 | 323 | throw new \RuntimeException('Log implementation has no path'); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | protected function run($argument) { |
155 | 155 | |
156 | 156 | $target = $argument['url']; |
157 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
157 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
158 | 158 | $currentTime = $this->timeFactory->getTime(); |
159 | 159 | $source = $this->urlGenerator->getAbsoluteURL('/'); |
160 | 160 | $source = rtrim($source, '/'); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
173 | 173 | |
174 | 174 | // make sure that we have a well formated url |
175 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/'); |
|
175 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/'); |
|
176 | 176 | |
177 | 177 | try { |
178 | 178 | $result = $this->httpClient->post( |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | } catch (ClientException $e) { |
194 | 194 | $status = $e->getCode(); |
195 | 195 | if ($status === Http::STATUS_FORBIDDEN) { |
196 | - $this->logger->info($target . ' refused to ask for a shared secret.', ['app' => 'federation']); |
|
196 | + $this->logger->info($target.' refused to ask for a shared secret.', ['app' => 'federation']); |
|
197 | 197 | } else { |
198 | - $this->logger->info($target . ' responded with a ' . $status . ' containing: ' . $e->getMessage(), ['app' => 'federation']); |
|
198 | + $this->logger->info($target.' responded with a '.$status.' containing: '.$e->getMessage(), ['app' => 'federation']); |
|
199 | 199 | } |
200 | 200 | } catch (RequestException $e) { |
201 | 201 | $status = -1; // There is no status code if we could not connect |
202 | - $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); |
|
202 | + $this->logger->info('Could not connect to '.$target, ['app' => 'federation']); |
|
203 | 203 | } catch (RingException $e) { |
204 | 204 | $status = -1; // There is no status code if we could not connect |
205 | - $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']); |
|
205 | + $this->logger->info('Could not connect to '.$target, ['app' => 'federation']); |
|
206 | 206 | } catch (\Exception $e) { |
207 | 207 | $status = Http::STATUS_INTERNAL_SERVER_ERROR; |
208 | 208 | $this->logger->logException($e, ['app' => 'federation']); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function reAddJob(array $argument) { |
227 | 227 | $url = $argument['url']; |
228 | - $created = isset($argument['created']) ? (int)$argument['created'] : $this->timeFactory->getTime(); |
|
228 | + $created = isset($argument['created']) ? (int) $argument['created'] : $this->timeFactory->getTime(); |
|
229 | 229 | $token = $argument['token']; |
230 | 230 | |
231 | 231 | $this->jobList->add( |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $this->recoveryKeyId = $this->config->getAppValue('encryption', |
129 | 129 | 'recoveryKeyId'); |
130 | 130 | if (empty($this->recoveryKeyId)) { |
131 | - $this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8); |
|
131 | + $this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8); |
|
132 | 132 | $this->config->setAppValue('encryption', |
133 | 133 | 'recoveryKeyId', |
134 | 134 | $this->recoveryKeyId); |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | $this->publicShareKeyId = $this->config->getAppValue('encryption', |
138 | 138 | 'publicShareKeyId'); |
139 | 139 | if (empty($this->publicShareKeyId)) { |
140 | - $this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8); |
|
140 | + $this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8); |
|
141 | 141 | $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); |
142 | 142 | } |
143 | 143 | |
144 | 144 | $this->masterKeyId = $this->config->getAppValue('encryption', |
145 | 145 | 'masterKeyId'); |
146 | 146 | if (empty($this->masterKeyId)) { |
147 | - $this->masterKeyId = 'master_' . substr(md5(time()), 0, 8); |
|
147 | + $this->masterKeyId = 'master_'.substr(md5(time()), 0, 8); |
|
148 | 148 | $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); |
149 | 149 | } |
150 | 150 | |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | |
163 | 163 | // Save public key |
164 | 164 | $this->keyStorage->setSystemUserKey( |
165 | - $this->publicShareKeyId . '.publicKey', $keyPair['publicKey'], |
|
165 | + $this->publicShareKeyId.'.publicKey', $keyPair['publicKey'], |
|
166 | 166 | Encryption::ID); |
167 | 167 | |
168 | 168 | // Encrypt private key empty passphrase |
169 | 169 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], ''); |
170 | 170 | $header = $this->crypt->generateHeader(); |
171 | - $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); |
|
171 | + $this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | |
188 | 188 | // Save public key |
189 | 189 | $this->keyStorage->setSystemUserKey( |
190 | - $this->masterKeyId . '.publicKey', $keyPair['publicKey'], |
|
190 | + $this->masterKeyId.'.publicKey', $keyPair['publicKey'], |
|
191 | 191 | Encryption::ID); |
192 | 192 | |
193 | 193 | // Encrypt private key with system password |
194 | 194 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId); |
195 | 195 | $header = $this->crypt->generateHeader(); |
196 | - $this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey); |
|
196 | + $this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | if (!$this->session->isPrivateKeySet()) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return string |
221 | 221 | */ |
222 | 222 | public function getRecoveryKey() { |
223 | - return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.publicKey', Encryption::ID); |
|
223 | + return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.publicKey', Encryption::ID); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return bool |
238 | 238 | */ |
239 | 239 | public function checkRecoveryPassword($password) { |
240 | - $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.privateKey', Encryption::ID); |
|
240 | + $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.privateKey', Encryption::ID); |
|
241 | 241 | $decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password); |
242 | 242 | |
243 | 243 | if ($decryptedRecoveryKey) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $header = $this->crypt->generateHeader(); |
262 | 262 | |
263 | 263 | if ($encryptedKey) { |
264 | - $this->setPrivateKey($uid, $header . $encryptedKey); |
|
264 | + $this->setPrivateKey($uid, $header.$encryptedKey); |
|
265 | 265 | return true; |
266 | 266 | } |
267 | 267 | return false; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $header = $this->crypt->generateHeader(); |
284 | 284 | |
285 | 285 | if ($encryptedKey) { |
286 | - $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey); |
|
286 | + $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey); |
|
287 | 287 | return true; |
288 | 288 | } |
289 | 289 | return false; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @return boolean |
344 | 344 | */ |
345 | 345 | public function setShareKey($path, $uid, $key) { |
346 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
346 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
347 | 347 | return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID); |
348 | 348 | } |
349 | 349 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $this->session->setStatus(Session::INIT_EXECUTED); |
360 | 360 | |
361 | 361 | try { |
362 | - if($this->util->isMasterKeyEnabled()) { |
|
362 | + if ($this->util->isMasterKeyEnabled()) { |
|
363 | 363 | $uid = $this->getMasterKeyId(); |
364 | 364 | $passPhrase = $this->getMasterKeyPassword(); |
365 | 365 | $privateKey = $this->getSystemPrivateKey($uid); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return false; |
374 | 374 | } catch (\Exception $e) { |
375 | 375 | $this->log->logException($e, [ |
376 | - 'message' => 'Could not decrypt the private key from user "' . $uid . '"" during login. Assume password change on the user back-end.', |
|
376 | + 'message' => 'Could not decrypt the private key from user "'.$uid.'"" during login. Assume password change on the user back-end.', |
|
377 | 377 | 'level' => ILogger::WARN, |
378 | 378 | 'app' => 'encryption', |
379 | 379 | ]); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | // use public share key for public links |
435 | 435 | $uid = $this->getPublicShareKeyId(); |
436 | 436 | $shareKey = $this->getShareKey($path, $uid); |
437 | - $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey', Encryption::ID); |
|
437 | + $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.privateKey', Encryption::ID); |
|
438 | 438 | $privateKey = $this->crypt->decryptPrivateKey($privateKey); |
439 | 439 | } else { |
440 | 440 | $shareKey = $this->getShareKey($path, $uid); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | */ |
460 | 460 | public function getVersion($path, View $view) { |
461 | 461 | $fileInfo = $view->getFileInfo($path); |
462 | - if($fileInfo === false) { |
|
462 | + if ($fileInfo === false) { |
|
463 | 463 | return 0; |
464 | 464 | } |
465 | 465 | return $fileInfo->getEncryptedVersion(); |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | * @param View $view |
474 | 474 | */ |
475 | 475 | public function setVersion($path, $version, View $view) { |
476 | - $fileInfo= $view->getFileInfo($path); |
|
476 | + $fileInfo = $view->getFileInfo($path); |
|
477 | 477 | |
478 | - if($fileInfo !== false) { |
|
478 | + if ($fileInfo !== false) { |
|
479 | 479 | $cache = $fileInfo->getStorage()->getCache(); |
480 | 480 | $cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]); |
481 | 481 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | public function deleteShareKey($path, $keyId) { |
505 | 505 | return $this->keyStorage->deleteFileKey( |
506 | 506 | $path, |
507 | - $keyId . '.' . $this->shareKeyId, |
|
507 | + $keyId.'.'.$this->shareKeyId, |
|
508 | 508 | Encryption::ID); |
509 | 509 | } |
510 | 510 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @return mixed |
516 | 516 | */ |
517 | 517 | public function getShareKey($path, $uid) { |
518 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
518 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
519 | 519 | return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID); |
520 | 520 | } |
521 | 521 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @return string |
578 | 578 | */ |
579 | 579 | public function getPublicShareKey() { |
580 | - return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.publicKey', Encryption::ID); |
|
580 | + return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.publicKey', Encryption::ID); |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @return string returns openssl key |
648 | 648 | */ |
649 | 649 | public function getSystemPrivateKey($keyId) { |
650 | - return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID); |
|
650 | + return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID); |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function setSystemPrivateKey($keyId, $key) { |
659 | 659 | return $this->keyStorage->setSystemUserKey( |
660 | - $keyId . '.' . $this->privateKeyId, |
|
660 | + $keyId.'.'.$this->privateKeyId, |
|
661 | 661 | $key, |
662 | 662 | Encryption::ID); |
663 | 663 | } |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | */ |
698 | 698 | public function getMasterKeyPassword() { |
699 | 699 | $password = $this->config->getSystemValue('secret'); |
700 | - if (empty($password)){ |
|
700 | + if (empty($password)) { |
|
701 | 701 | throw new \Exception('Can not get secret from Nextcloud instance'); |
702 | 702 | } |
703 | 703 | |
@@ -719,6 +719,6 @@ discard block |
||
719 | 719 | * @return string |
720 | 720 | */ |
721 | 721 | public function getPublicMasterKey() { |
722 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.publicKey', Encryption::ID); |
|
722 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.publicKey', Encryption::ID); |
|
723 | 723 | } |
724 | 724 | } |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | * Remove "apps/" from inclusion path for smooth migration to multi app dir |
102 | 102 | */ |
103 | 103 | if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) { |
104 | - \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', ILogger::DEBUG); |
|
104 | + \OCP\Util::writeLog('core', 'include path for class "'.$class.'" starts with "apps/"', ILogger::DEBUG); |
|
105 | 105 | $paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]); |
106 | 106 | } |
107 | 107 | } elseif (strpos($class, 'OC_') === 0) { |
108 | - $paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); |
|
108 | + $paths[] = \OC::$SERVERROOT.'/lib/private/legacy/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php'); |
|
109 | 109 | } elseif (strpos($class, 'OCA\\') === 0) { |
110 | 110 | list(, $app, $rest) = explode('\\', $class, 3); |
111 | 111 | $app = strtolower($app); |
112 | 112 | $appPath = \OC_App::getAppPath($app); |
113 | 113 | if ($appPath && stream_resolve_include_path($appPath)) { |
114 | - $paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
114 | + $paths[] = $appPath.'/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
115 | 115 | // If not found in the root of the app directory, insert '/lib' after app id and try again. |
116 | - $paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php'); |
|
116 | + $paths[] = $appPath.'/lib/'.strtolower(str_replace('\\', '/', $rest).'.php'); |
|
117 | 117 | } |
118 | 118 | } elseif ($class === 'Test\\TestCase') { |
119 | 119 | // This File is considered public API, so we make sure that the class |
120 | 120 | // can still be loaded, although the PSR-4 paths have not been loaded. |
121 | - $paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php'; |
|
121 | + $paths[] = \OC::$SERVERROOT.'/tests/lib/TestCase.php'; |
|
122 | 122 | } |
123 | 123 | return $paths; |
124 | 124 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function isValidPath(string $fullPath): bool { |
132 | 132 | foreach ($this->validRoots as $root => $true) { |
133 | - if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') { |
|
133 | + if (substr($fullPath, 0, strlen($root) + 1) === $root.'/') { |
|
134 | 134 | return true; |
135 | 135 | } |
136 | 136 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $pathsToRequire = $this->memoryCache->get($class); |
151 | 151 | } |
152 | 152 | |
153 | - if(class_exists($class, false)) { |
|
153 | + if (class_exists($class, false)) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | try { |
66 | 66 | return new \DateTimeZone($timeZone); |
67 | 67 | } catch (\Exception $e) { |
68 | - \OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", ILogger::DEBUG); |
|
68 | + \OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "'.$timeZone."'", ILogger::DEBUG); |
|
69 | 69 | return new \DateTimeZone($this->getDefaultTimeZone()); |
70 | 70 | } |
71 | 71 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | // so a positive offset means negative timeZone |
87 | 87 | // and the other way around. |
88 | 88 | if ($offset > 0) { |
89 | - $timeZone = 'Etc/GMT-' . $offset; |
|
89 | + $timeZone = 'Etc/GMT-'.$offset; |
|
90 | 90 | } else { |
91 | - $timeZone = 'Etc/GMT+' . abs($offset); |
|
91 | + $timeZone = 'Etc/GMT+'.abs($offset); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return new \DateTimeZone($timeZone); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | // No timezone found, fallback to UTC |
113 | - \OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", ILogger::DEBUG); |
|
113 | + \OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "'.$offset."'", ILogger::DEBUG); |
|
114 | 114 | return new \DateTimeZone($this->getDefaultTimeZone()); |
115 | 115 | } |
116 | 116 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } else { |
107 | 107 | // Update old classes to new namespace |
108 | 108 | if (strpos($storage, 'OC_Filestorage_') !== false) { |
109 | - $storage = '\OC\Files\Storage\\' . substr($storage, 15); |
|
109 | + $storage = '\OC\Files\Storage\\'.substr($storage, 15); |
|
110 | 110 | } |
111 | 111 | $this->class = $storage; |
112 | 112 | $this->arguments = $arguments; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return; |
159 | 159 | } |
160 | 160 | } else { |
161 | - \OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', ILogger::ERROR); |
|
161 | + \OCP\Util::writeLog('core', 'storage backend '.$this->class.' not found', ILogger::ERROR); |
|
162 | 162 | $this->invalidStorage = true; |
163 | 163 | return; |
164 | 164 | } |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function getInternalPath($path) { |
210 | 210 | $path = Filesystem::normalizePath($path, true, false, true); |
211 | - if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) { |
|
211 | + if ($this->mountPoint === $path or $this->mountPoint.'/' === $path) { |
|
212 | 212 | $internalPath = ''; |
213 | 213 | } else { |
214 | 214 | $internalPath = substr($path, strlen($this->mountPoint)); |
215 | 215 | } |
216 | 216 | // substr returns false instead of an empty string, we always want a string |
217 | - return (string)$internalPath; |
|
217 | + return (string) $internalPath; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | public function getStorageRootId() { |
269 | 269 | if (is_null($this->rootId)) { |
270 | - $this->rootId = (int)$this->getStorage()->getCache()->getId(''); |
|
270 | + $this->rootId = (int) $this->getStorage()->getCache()->getId(''); |
|
271 | 271 | } |
272 | 272 | return $this->rootId; |
273 | 273 | } |
@@ -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 | } |
@@ -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. |