@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return bool |
97 | 97 | */ |
98 | 98 | public function isCodeCheckEnforced() { |
99 | - $notSignedChannels = [ '', 'git']; |
|
99 | + $notSignedChannels = ['', 'git']; |
|
100 | 100 | if (in_array($this->environmentHelper->getChannel(), $notSignedChannels, true)) { |
101 | 101 | return false; |
102 | 102 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $folderToIterate, |
132 | 132 | \RecursiveDirectoryIterator::SKIP_DOTS |
133 | 133 | ); |
134 | - if($root === '') { |
|
134 | + if ($root === '') { |
|
135 | 135 | $root = \OC::$SERVERROOT; |
136 | 136 | } |
137 | 137 | $root = rtrim($root, '/'); |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | $tmpFolder = ''; |
161 | 161 | |
162 | 162 | $baseDirectoryLength = strlen($path); |
163 | - foreach($iterator as $filename => $data) { |
|
163 | + foreach ($iterator as $filename => $data) { |
|
164 | 164 | /** @var \DirectoryIterator $data */ |
165 | - if($data->isDir()) { |
|
165 | + if ($data->isDir()) { |
|
166 | 166 | continue; |
167 | 167 | } |
168 | 168 | |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | $relativeFileName = ltrim($relativeFileName, '/'); |
171 | 171 | |
172 | 172 | // Exclude signature.json files in the appinfo and root folder |
173 | - if($relativeFileName === 'appinfo/signature.json') { |
|
173 | + if ($relativeFileName === 'appinfo/signature.json') { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | // Exclude signature.json files in the appinfo and core folder |
177 | - if($relativeFileName === 'core/signature.json') { |
|
177 | + if ($relativeFileName === 'core/signature.json') { |
|
178 | 178 | continue; |
179 | 179 | } |
180 | 180 | |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | // to ensure that this will not lead to false positives this will |
184 | 184 | // copy the file to a temporary folder and reset it to the default |
185 | 185 | // values. |
186 | - if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess' |
|
187 | - || $filename === $this->environmentHelper->getServerRoot() . '/.user.ini') { |
|
186 | + if ($filename === $this->environmentHelper->getServerRoot().'/.htaccess' |
|
187 | + || $filename === $this->environmentHelper->getServerRoot().'/.user.ini') { |
|
188 | 188 | |
189 | - if(!$copiedWebserverSettingFiles) { |
|
189 | + if (!$copiedWebserverSettingFiles) { |
|
190 | 190 | $tmpFolder = rtrim($this->tempManager->getTemporaryFolder(), '/'); |
191 | - copy($this->environmentHelper->getServerRoot() . '/.htaccess', $tmpFolder . '/.htaccess'); |
|
192 | - copy($this->environmentHelper->getServerRoot() . '/.user.ini', $tmpFolder . '/.user.ini'); |
|
191 | + copy($this->environmentHelper->getServerRoot().'/.htaccess', $tmpFolder.'/.htaccess'); |
|
192 | + copy($this->environmentHelper->getServerRoot().'/.user.ini', $tmpFolder.'/.user.ini'); |
|
193 | 193 | \OC_Files::setUploadLimit( |
194 | 194 | \OCP\Util::computerFileSize('511MB'), |
195 | 195 | [ |
196 | - '.htaccess' => $tmpFolder . '/.htaccess', |
|
197 | - '.user.ini' => $tmpFolder . '/.user.ini', |
|
196 | + '.htaccess' => $tmpFolder.'/.htaccess', |
|
197 | + '.user.ini' => $tmpFolder.'/.user.ini', |
|
198 | 198 | ] |
199 | 199 | ); |
200 | 200 | } |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | // The .user.ini file can contain custom modifications to the file size |
204 | 204 | // as well. |
205 | - if($filename === $this->environmentHelper->getServerRoot() . '/.user.ini') { |
|
206 | - $fileContent = file_get_contents($tmpFolder . '/.user.ini'); |
|
205 | + if ($filename === $this->environmentHelper->getServerRoot().'/.user.ini') { |
|
206 | + $fileContent = file_get_contents($tmpFolder.'/.user.ini'); |
|
207 | 207 | $hashes[$relativeFileName] = hash('sha512', $fileContent); |
208 | 208 | continue; |
209 | 209 | } |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | // Thus we ignore everything below the first occurrence of |
216 | 216 | // "#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####" and have the |
217 | 217 | // hash generated based on this. |
218 | - if($filename === $this->environmentHelper->getServerRoot() . '/.htaccess') { |
|
219 | - $fileContent = file_get_contents($tmpFolder . '/.htaccess'); |
|
218 | + if ($filename === $this->environmentHelper->getServerRoot().'/.htaccess') { |
|
219 | + $fileContent = file_get_contents($tmpFolder.'/.htaccess'); |
|
220 | 220 | $explodedArray = explode('#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####', $fileContent); |
221 | - if(count($explodedArray) === 2) { |
|
221 | + if (count($explodedArray) === 2) { |
|
222 | 222 | $hashes[$relativeFileName] = hash('sha512', $explodedArray[0]); |
223 | 223 | continue; |
224 | 224 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | public function writeAppSignature($path, |
268 | 268 | X509 $certificate, |
269 | 269 | RSA $privateKey) { |
270 | - $appInfoDir = $path . '/appinfo'; |
|
270 | + $appInfoDir = $path.'/appinfo'; |
|
271 | 271 | try { |
272 | 272 | $this->fileAccessHelper->assertDirectoryExists($appInfoDir); |
273 | 273 | |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | $hashes = $this->generateHashes($iterator, $path); |
276 | 276 | $signature = $this->createSignatureData($hashes, $certificate, $privateKey); |
277 | 277 | $this->fileAccessHelper->file_put_contents( |
278 | - $appInfoDir . '/signature.json', |
|
278 | + $appInfoDir.'/signature.json', |
|
279 | 279 | json_encode($signature, JSON_PRETTY_PRINT) |
280 | 280 | ); |
281 | - } catch (\Exception $e){ |
|
281 | + } catch (\Exception $e) { |
|
282 | 282 | if (!$this->fileAccessHelper->is_writable($appInfoDir)) { |
283 | - throw new \Exception($appInfoDir . ' is not writable'); |
|
283 | + throw new \Exception($appInfoDir.' is not writable'); |
|
284 | 284 | } |
285 | 285 | throw $e; |
286 | 286 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | public function writeCoreSignature(X509 $certificate, |
298 | 298 | RSA $rsa, |
299 | 299 | $path) { |
300 | - $coreDir = $path . '/core'; |
|
300 | + $coreDir = $path.'/core'; |
|
301 | 301 | try { |
302 | 302 | |
303 | 303 | $this->fileAccessHelper->assertDirectoryExists($coreDir); |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | $hashes = $this->generateHashes($iterator, $path); |
306 | 306 | $signatureData = $this->createSignatureData($hashes, $certificate, $rsa); |
307 | 307 | $this->fileAccessHelper->file_put_contents( |
308 | - $coreDir . '/signature.json', |
|
308 | + $coreDir.'/signature.json', |
|
309 | 309 | json_encode($signatureData, JSON_PRETTY_PRINT) |
310 | 310 | ); |
311 | - } catch (\Exception $e){ |
|
311 | + } catch (\Exception $e) { |
|
312 | 312 | if (!$this->fileAccessHelper->is_writable($coreDir)) { |
313 | - throw new \Exception($coreDir . ' is not writable'); |
|
313 | + throw new \Exception($coreDir.' is not writable'); |
|
314 | 314 | } |
315 | 315 | throw $e; |
316 | 316 | } |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | * @throws \Exception |
328 | 328 | */ |
329 | 329 | private function verify($signaturePath, $basePath, $certificateCN) { |
330 | - if(!$this->isCodeCheckEnforced()) { |
|
330 | + if (!$this->isCodeCheckEnforced()) { |
|
331 | 331 | return []; |
332 | 332 | } |
333 | 333 | |
334 | 334 | $signatureData = json_decode($this->fileAccessHelper->file_get_contents($signaturePath), true); |
335 | - if(!is_array($signatureData)) { |
|
335 | + if (!is_array($signatureData)) { |
|
336 | 336 | throw new InvalidSignatureException('Signature data not found.'); |
337 | 337 | } |
338 | 338 | |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | $rootCertificatePublicKey = $this->fileAccessHelper->file_get_contents($this->environmentHelper->getServerRoot().'/resources/codesigning/root.crt'); |
347 | 347 | $x509->loadCA($rootCertificatePublicKey); |
348 | 348 | $x509->loadX509($certificate); |
349 | - if(!$x509->validateSignature()) { |
|
349 | + if (!$x509->validateSignature()) { |
|
350 | 350 | throw new InvalidSignatureException('Certificate is not valid.'); |
351 | 351 | } |
352 | 352 | // Verify if certificate has proper CN. "core" CN is always trusted. |
353 | - if($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') { |
|
353 | + if ($x509->getDN(X509::DN_OPENSSL)['CN'] !== $certificateCN && $x509->getDN(X509::DN_OPENSSL)['CN'] !== 'core') { |
|
354 | 354 | throw new InvalidSignatureException( |
355 | 355 | sprintf('Certificate is not valid for required scope. (Requested: %s, current: CN=%s)', $certificateCN, $x509->getDN(true)['CN']) |
356 | 356 | ); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $rsa->setMGFHash('sha512'); |
364 | 364 | // See https://tools.ietf.org/html/rfc3447#page-38 |
365 | 365 | $rsa->setSaltLength(0); |
366 | - if(!$rsa->verify(json_encode($expectedHashes), $signature)) { |
|
366 | + if (!$rsa->verify(json_encode($expectedHashes), $signature)) { |
|
367 | 367 | throw new InvalidSignatureException('Signature could not get verified.'); |
368 | 368 | } |
369 | 369 | |
@@ -372,9 +372,9 @@ discard block |
||
372 | 372 | // |
373 | 373 | // Due to this reason we exclude the whole updater/ folder from the code |
374 | 374 | // integrity check. |
375 | - if($basePath === $this->environmentHelper->getServerRoot()) { |
|
376 | - foreach($expectedHashes as $fileName => $hash) { |
|
377 | - if(strpos($fileName, 'updater/') === 0) { |
|
375 | + if ($basePath === $this->environmentHelper->getServerRoot()) { |
|
376 | + foreach ($expectedHashes as $fileName => $hash) { |
|
377 | + if (strpos($fileName, 'updater/') === 0) { |
|
378 | 378 | unset($expectedHashes[$fileName]); |
379 | 379 | } |
380 | 380 | } |
@@ -386,23 +386,23 @@ discard block |
||
386 | 386 | $differencesB = array_diff($currentInstanceHashes, $expectedHashes); |
387 | 387 | $differences = array_unique(array_merge($differencesA, $differencesB)); |
388 | 388 | $differenceArray = []; |
389 | - foreach($differences as $filename => $hash) { |
|
389 | + foreach ($differences as $filename => $hash) { |
|
390 | 390 | // Check if file should not exist in the new signature table |
391 | - if(!array_key_exists($filename, $expectedHashes)) { |
|
391 | + if (!array_key_exists($filename, $expectedHashes)) { |
|
392 | 392 | $differenceArray['EXTRA_FILE'][$filename]['expected'] = ''; |
393 | 393 | $differenceArray['EXTRA_FILE'][$filename]['current'] = $hash; |
394 | 394 | continue; |
395 | 395 | } |
396 | 396 | |
397 | 397 | // Check if file is missing |
398 | - if(!array_key_exists($filename, $currentInstanceHashes)) { |
|
398 | + if (!array_key_exists($filename, $currentInstanceHashes)) { |
|
399 | 399 | $differenceArray['FILE_MISSING'][$filename]['expected'] = $expectedHashes[$filename]; |
400 | 400 | $differenceArray['FILE_MISSING'][$filename]['current'] = ''; |
401 | 401 | continue; |
402 | 402 | } |
403 | 403 | |
404 | 404 | // Check if hash does mismatch |
405 | - if($expectedHashes[$filename] !== $currentInstanceHashes[$filename]) { |
|
405 | + if ($expectedHashes[$filename] !== $currentInstanceHashes[$filename]) { |
|
406 | 406 | $differenceArray['INVALID_HASH'][$filename]['expected'] = $expectedHashes[$filename]; |
407 | 407 | $differenceArray['INVALID_HASH'][$filename]['current'] = $currentInstanceHashes[$filename]; |
408 | 408 | continue; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function hasPassedCheck() { |
424 | 424 | $results = $this->getResults(); |
425 | - if(empty($results)) { |
|
425 | + if (empty($results)) { |
|
426 | 426 | return true; |
427 | 427 | } |
428 | 428 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | */ |
435 | 435 | public function getResults() { |
436 | 436 | $cachedResults = $this->cache->get(self::CACHE_KEY); |
437 | - if(!is_null($cachedResults)) { |
|
437 | + if (!is_null($cachedResults)) { |
|
438 | 438 | return json_decode($cachedResults, true); |
439 | 439 | } |
440 | 440 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | private function storeResults($scope, array $result) { |
454 | 454 | $resultArray = $this->getResults(); |
455 | 455 | unset($resultArray[$scope]); |
456 | - if(!empty($result)) { |
|
456 | + if (!empty($result)) { |
|
457 | 457 | $resultArray[$scope] = $result; |
458 | 458 | } |
459 | 459 | if ($this->config !== null) { |
@@ -505,11 +505,11 @@ discard block |
||
505 | 505 | */ |
506 | 506 | public function verifyAppSignature($appId, $path = '') { |
507 | 507 | try { |
508 | - if($path === '') { |
|
508 | + if ($path === '') { |
|
509 | 509 | $path = $this->appLocator->getAppPath($appId); |
510 | 510 | } |
511 | 511 | $result = $this->verify( |
512 | - $path . '/appinfo/signature.json', |
|
512 | + $path.'/appinfo/signature.json', |
|
513 | 513 | $path, |
514 | 514 | $appId |
515 | 515 | ); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | public function verifyCoreSignature() { |
560 | 560 | try { |
561 | 561 | $result = $this->verify( |
562 | - $this->environmentHelper->getServerRoot() . '/core/signature.json', |
|
562 | + $this->environmentHelper->getServerRoot().'/core/signature.json', |
|
563 | 563 | $this->environmentHelper->getServerRoot(), |
564 | 564 | 'core' |
565 | 565 | ); |
@@ -584,18 +584,18 @@ discard block |
||
584 | 584 | $this->cleanResults(); |
585 | 585 | $this->verifyCoreSignature(); |
586 | 586 | $appIds = $this->appLocator->getAllApps(); |
587 | - foreach($appIds as $appId) { |
|
587 | + foreach ($appIds as $appId) { |
|
588 | 588 | // If an application is shipped a valid signature is required |
589 | 589 | $isShipped = $this->appManager->isShipped($appId); |
590 | 590 | $appNeedsToBeChecked = false; |
591 | 591 | if ($isShipped) { |
592 | 592 | $appNeedsToBeChecked = true; |
593 | - } elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId) . '/appinfo/signature.json')) { |
|
593 | + } elseif ($this->fileAccessHelper->file_exists($this->appLocator->getAppPath($appId).'/appinfo/signature.json')) { |
|
594 | 594 | // Otherwise only if the application explicitly ships a signature.json file |
595 | 595 | $appNeedsToBeChecked = true; |
596 | 596 | } |
597 | 597 | |
598 | - if($appNeedsToBeChecked) { |
|
598 | + if ($appNeedsToBeChecked) { |
|
599 | 599 | $this->verifyAppSignature($appId); |
600 | 600 | } |
601 | 601 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * the transformed app id, defaults to OCA\ |
54 | 54 | * @return string the starting namespace for the app |
55 | 55 | */ |
56 | - public static function buildAppNamespace($appId, $topNamespace='OCA\\') { |
|
56 | + public static function buildAppNamespace($appId, $topNamespace = 'OCA\\') { |
|
57 | 57 | // Hit the cache! |
58 | 58 | if (isset(self::$nameSpaceCache[$appId])) { |
59 | - return $topNamespace . self::$nameSpaceCache[$appId]; |
|
59 | + return $topNamespace.self::$nameSpaceCache[$appId]; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $appInfo = \OC_App::getAppInfo($appId); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | self::$nameSpaceCache[$appId] = ucfirst($appId); |
68 | 68 | } |
69 | 69 | |
70 | - return $topNamespace . self::$nameSpaceCache[$appId]; |
|
70 | + return $topNamespace.self::$nameSpaceCache[$appId]; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | // first try $controllerName then go for \OCA\AppName\Controller\$controllerName |
91 | 91 | try { |
92 | 92 | $controller = $container->query($controllerName); |
93 | - } catch(QueryException $e) { |
|
93 | + } catch (QueryException $e) { |
|
94 | 94 | if ($appName === 'core') { |
95 | 95 | $appNameSpace = 'OC\\Core'; |
96 | 96 | } else if ($appName === 'settings') { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } else { |
99 | 99 | $appNameSpace = self::buildAppNamespace($appName); |
100 | 100 | } |
101 | - $controllerName = $appNameSpace . '\\Controller\\' . $controllerName; |
|
101 | + $controllerName = $appNameSpace.'\\Controller\\'.$controllerName; |
|
102 | 102 | $controller = $container->query($controllerName); |
103 | 103 | } |
104 | 104 | |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | |
117 | 117 | $io = $container['OCP\\AppFramework\\Http\\IOutput']; |
118 | 118 | |
119 | - if(!is_null($httpHeaders)) { |
|
119 | + if (!is_null($httpHeaders)) { |
|
120 | 120 | $io->setHeader($httpHeaders); |
121 | 121 | } |
122 | 122 | |
123 | - foreach($responseHeaders as $name => $value) { |
|
124 | - $io->setHeader($name . ': ' . $value); |
|
123 | + foreach ($responseHeaders as $name => $value) { |
|
124 | + $io->setHeader($name.': '.$value); |
|
125 | 125 | } |
126 | 126 | |
127 | - foreach($responseCookies as $name => $value) { |
|
127 | + foreach ($responseCookies as $name => $value) { |
|
128 | 128 | $expireDate = null; |
129 | - if($value['expireDate'] instanceof \DateTime) { |
|
129 | + if ($value['expireDate'] instanceof \DateTime) { |
|
130 | 130 | $expireDate = $value['expireDate']->getTimestamp(); |
131 | 131 | } |
132 | 132 | $io->setCookie( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if ($response instanceof ICallbackResponse) { |
151 | 151 | $response->callback($io); |
152 | 152 | } else if (!is_null($output)) { |
153 | - $io->setHeader('Content-Length: ' . strlen($output)); |
|
153 | + $io->setHeader('Content-Length: '.strlen($output)); |
|
154 | 154 | $io->setOutput($output); |
155 | 155 | } |
156 | 156 | } |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | * @param DIContainer $container an instance of a pimple container. |
171 | 171 | */ |
172 | 172 | public static function part($controllerName, $methodName, array $urlParams, |
173 | - DIContainer $container){ |
|
173 | + DIContainer $container) { |
|
174 | 174 | |
175 | 175 | $container['urlParams'] = $urlParams; |
176 | 176 | $controller = $container[$controllerName]; |
177 | 177 | |
178 | 178 | $dispatcher = $container['Dispatcher']; |
179 | 179 | |
180 | - list(, , $output) = $dispatcher->dispatch($controller, $methodName); |
|
180 | + list(,, $output) = $dispatcher->dispatch($controller, $methodName); |
|
181 | 181 | return $output; |
182 | 182 | } |
183 | 183 |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function getMountsForUser(IUser $user) { |
76 | 76 | $loader = $this->loader; |
77 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
77 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
78 | 78 | return $provider->getMountsForUser($user, $loader); |
79 | 79 | }, $this->providers); |
80 | - $mounts = array_filter($mounts, function ($result) { |
|
80 | + $mounts = array_filter($mounts, function($result) { |
|
81 | 81 | return is_array($result); |
82 | 82 | }); |
83 | - return array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
83 | + return array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
84 | 84 | return array_merge($mounts, $providerMounts); |
85 | 85 | }, array()); |
86 | 86 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | // shared mount provider gets to go last since it needs to know existing files |
90 | 90 | // to check for name collisions |
91 | 91 | $firstMounts = []; |
92 | - $firstProviders = array_filter($this->providers, function (IMountProvider $provider) { |
|
92 | + $firstProviders = array_filter($this->providers, function(IMountProvider $provider) { |
|
93 | 93 | return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); |
94 | 94 | }); |
95 | - $lastProviders = array_filter($this->providers, function (IMountProvider $provider) { |
|
95 | + $lastProviders = array_filter($this->providers, function(IMountProvider $provider) { |
|
96 | 96 | return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); |
97 | 97 | }); |
98 | 98 | foreach ($firstProviders as $provider) { |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
129 | 129 | foreach ($providers as $homeProvider) { |
130 | 130 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
131 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
131 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
132 | 132 | return $mount; |
133 | 133 | } |
134 | 134 | } |
135 | - throw new \Exception('No home storage configured for user ' . $user); |
|
135 | + throw new \Exception('No home storage configured for user '.$user); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $result = array(); |
45 | 45 | $timestamp = null; |
46 | 46 | |
47 | - $view = new \OC\Files\View('/' . $user . '/files_trashbin/files'); |
|
47 | + $view = new \OC\Files\View('/'.$user.'/files_trashbin/files'); |
|
48 | 48 | |
49 | 49 | if (ltrim($dir, '/') !== '' && !$view->is_dir($dir)) { |
50 | 50 | throw new \Exception('Directory does not exists'); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $timestamp = substr(pathinfo($parts[0], PATHINFO_EXTENSION), 1); |
73 | 73 | } |
74 | 74 | $originalPath = ''; |
75 | - $originalName = substr($entryName, 0, -strlen($timestamp)-2); |
|
75 | + $originalName = substr($entryName, 0, -strlen($timestamp) - 2); |
|
76 | 76 | if (isset($originalLocations[$originalName][$timestamp])) { |
77 | 77 | $originalPath = $originalLocations[$originalName][$timestamp]; |
78 | 78 | if (substr($originalPath, -1) === '/') { |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | ); |
93 | 93 | if ($originalPath) { |
94 | 94 | if ($originalPath !== '.') { |
95 | - $i['extraData'] = $originalPath . '/' . $originalName; |
|
95 | + $i['extraData'] = $originalPath.'/'.$originalName; |
|
96 | 96 | } else { |
97 | 97 | $i['extraData'] = $originalName; |
98 | 98 | } |
99 | 99 | } |
100 | - $result[] = new FileInfo($absoluteDir . '/' . $i['name'], $storage, $internalPath . '/' . $i['name'], $i, $mount); |
|
100 | + $result[] = new FileInfo($absoluteDir.'/'.$i['name'], $storage, $internalPath.'/'.$i['name'], $i, $mount); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($sortAttribute !== '') { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $this->sourceUser = $sourceUserObject->getUID(); |
120 | 120 | $this->destinationUser = $destinationUserObject->getUID(); |
121 | 121 | $sourcePathOption = ltrim($input->getOption('path'), '/'); |
122 | - $this->sourcePath = rtrim($this->sourceUser . '/files/' . $sourcePathOption, '/'); |
|
122 | + $this->sourcePath = rtrim($this->sourceUser.'/files/'.$sourcePathOption, '/'); |
|
123 | 123 | |
124 | 124 | // target user has to be ready |
125 | 125 | if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $self = $this; |
177 | 177 | |
178 | 178 | $this->walkFiles($view, $this->sourcePath, |
179 | - function (FileInfo $fileInfo) use ($progress, $self) { |
|
179 | + function(FileInfo $fileInfo) use ($progress, $self) { |
|
180 | 180 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
181 | 181 | // only analyze into folders from main storage, |
182 | 182 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | // no file is allowed to be encrypted |
198 | 198 | if (!empty($this->encryptedFiles)) { |
199 | 199 | $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
200 | - foreach($this->encryptedFiles as $encryptedFile) { |
|
200 | + foreach ($this->encryptedFiles as $encryptedFile) { |
|
201 | 201 | /** @var FileInfo $encryptedFile */ |
202 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
202 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
203 | 203 | } |
204 | 204 | throw new \Exception('Execution terminated.'); |
205 | 205 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $output->writeln("Collecting all share information for files and folder of $this->sourceUser ..."); |
214 | 214 | |
215 | 215 | $progress = new ProgressBar($output, count($this->shares)); |
216 | - foreach([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
216 | + foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
217 | 217 | $offset = 0; |
218 | 218 | while (true) { |
219 | 219 | $sharePage = $this->shareManager->getSharesBy($this->sourceUser, $shareType, null, true, 50, $offset); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | |
240 | 240 | // This change will help user to transfer the folder specified using --path option. |
241 | 241 | // Else only the content inside folder is transferred which is not correct. |
242 | - if($this->sourcePath !== "$this->sourceUser/files") { |
|
242 | + if ($this->sourcePath !== "$this->sourceUser/files") { |
|
243 | 243 | $view->mkdir($this->finalTarget); |
244 | - $this->finalTarget = $this->finalTarget . '/' . basename($this->sourcePath); |
|
244 | + $this->finalTarget = $this->finalTarget.'/'.basename($this->sourcePath); |
|
245 | 245 | } |
246 | 246 | $view->rename($this->sourcePath, $this->finalTarget); |
247 | 247 | if (!is_dir("$this->sourceUser/files")) { |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | $output->writeln("Restoring shares ..."); |
258 | 258 | $progress = new ProgressBar($output, count($this->shares)); |
259 | 259 | |
260 | - foreach($this->shares as $share) { |
|
260 | + foreach ($this->shares as $share) { |
|
261 | 261 | try { |
262 | 262 | if ($share->getSharedWith() === $this->destinationUser) { |
263 | 263 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
264 | - $shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget()); |
|
264 | + $shareMountPoint = $this->mountManager->find('/'.$this->destinationUser.'/files'.$share->getTarget()); |
|
265 | 265 | if ($shareMountPoint) { |
266 | 266 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
267 | 267 | } |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | $this->shareManager->updateShare($share); |
278 | 278 | } |
279 | 279 | } catch (\OCP\Files\NotFoundException $e) { |
280 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
280 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
281 | 281 | } catch (\Exception $e) { |
282 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
282 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
283 | 283 | } |
284 | 284 | $progress->advance(); |
285 | 285 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]); |
111 | 111 | } |
112 | 112 | // password policy app throws exception |
113 | - } catch(HintException $e) { |
|
113 | + } catch (HintException $e) { |
|
114 | 114 | return new JSONResponse([ |
115 | 115 | 'status' => 'error', |
116 | 116 | 'data' => [ |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | 'message' => $this->l->t('Please provide an admin recovery password; otherwise, all user data will be lost.'), |
221 | 221 | ] |
222 | 222 | ]); |
223 | - } elseif ($recoveryEnabledForUser && ! $validRecoveryPassword) { |
|
223 | + } elseif ($recoveryEnabledForUser && !$validRecoveryPassword) { |
|
224 | 224 | return new JSONResponse([ |
225 | 225 | 'status' => 'error', |
226 | 226 | 'data' => [ |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | try { |
232 | 232 | $result = $targetUser->setPassword($password, $recoveryPassword); |
233 | 233 | // password policy app throws exception |
234 | - } catch(HintException $e) { |
|
234 | + } catch (HintException $e) { |
|
235 | 235 | return new JSONResponse([ |
236 | 236 | 'status' => 'error', |
237 | 237 | 'data' => [ |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | ]); |
267 | 267 | } |
268 | 268 | // password policy app throws exception |
269 | - } catch(HintException $e) { |
|
269 | + } catch (HintException $e) { |
|
270 | 270 | return new JSONResponse([ |
271 | 271 | 'status' => 'error', |
272 | 272 | 'data' => [ |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * http://%host/%context/remote.php/webdav/%root |
33 | 33 | * |
34 | 34 | */ |
35 | -class OwnCloud extends \OC\Files\Storage\DAV{ |
|
35 | +class OwnCloud extends \OC\Files\Storage\DAV { |
|
36 | 36 | const OC_URL_SUFFIX = 'remote.php/webdav'; |
37 | 37 | |
38 | 38 | public function __construct($params) { |
@@ -49,27 +49,27 @@ discard block |
||
49 | 49 | } |
50 | 50 | $contextPath = ''; |
51 | 51 | $hostSlashPos = strpos($host, '/'); |
52 | - if ($hostSlashPos !== false){ |
|
52 | + if ($hostSlashPos !== false) { |
|
53 | 53 | $contextPath = substr($host, $hostSlashPos); |
54 | 54 | $host = substr($host, 0, $hostSlashPos); |
55 | 55 | } |
56 | 56 | |
57 | - if (substr($contextPath, -1) !== '/'){ |
|
57 | + if (substr($contextPath, -1) !== '/') { |
|
58 | 58 | $contextPath .= '/'; |
59 | 59 | } |
60 | 60 | |
61 | - if (isset($params['root'])){ |
|
61 | + if (isset($params['root'])) { |
|
62 | 62 | $root = $params['root']; |
63 | - if (substr($root, 0, 1) !== '/'){ |
|
64 | - $root = '/' . $root; |
|
63 | + if (substr($root, 0, 1) !== '/') { |
|
64 | + $root = '/'.$root; |
|
65 | 65 | } |
66 | 66 | } |
67 | - else{ |
|
67 | + else { |
|
68 | 68 | $root = '/'; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $params['host'] = $host; |
72 | - $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root; |
|
72 | + $params['root'] = $contextPath.self::OC_URL_SUFFIX.$root; |
|
73 | 73 | $params['authType'] = Client::AUTH_BASIC; |
74 | 74 | |
75 | 75 | parent::__construct($params); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (is_string($params['secure'])) { |
105 | 105 | $this->secure = ($params['secure'] === 'true'); |
106 | 106 | } else { |
107 | - $this->secure = (bool)$params['secure']; |
|
107 | + $this->secure = (bool) $params['secure']; |
|
108 | 108 | } |
109 | 109 | } else { |
110 | 110 | $this->secure = false; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | $this->root = isset($params['root']) ? $params['root'] : '/'; |
124 | 124 | if (!$this->root || $this->root[0] != '/') { |
125 | - $this->root = '/' . $this->root; |
|
125 | + $this->root = '/'.$this->root; |
|
126 | 126 | } |
127 | 127 | if (substr($this->root, -1, 1) != '/') { |
128 | 128 | $this->root .= '/'; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | $proxy = \OC::$server->getConfig()->getSystemValue('proxy', ''); |
151 | - if($proxy !== '') { |
|
151 | + if ($proxy !== '') { |
|
152 | 152 | $settings['proxy'] = $proxy; |
153 | 153 | } |
154 | 154 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | /** {@inheritdoc} */ |
170 | 170 | public function getId() { |
171 | - return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root; |
|
171 | + return 'webdav::'.$this->user.'@'.$this->host.'/'.$this->root; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** {@inheritdoc} */ |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | if ($this->secure) { |
178 | 178 | $baseUri .= 's'; |
179 | 179 | } |
180 | - $baseUri .= '://' . $this->host . $this->root; |
|
180 | + $baseUri .= '://'.$this->host.$this->root; |
|
181 | 181 | return $baseUri; |
182 | 182 | } |
183 | 183 | |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | $path = $this->cleanPath($path); |
199 | 199 | // FIXME: some WebDAV impl return 403 when trying to DELETE |
200 | 200 | // a non-empty folder |
201 | - $result = $this->simpleResponse('DELETE', $path . '/', null, 204); |
|
202 | - $this->statCache->clear($path . '/'); |
|
201 | + $result = $this->simpleResponse('DELETE', $path.'/', null, 204); |
|
202 | + $this->statCache->clear($path.'/'); |
|
203 | 203 | $this->statCache->remove($path); |
204 | 204 | return $result; |
205 | 205 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $this->statCache->set($path, $response); |
275 | 275 | } catch (ClientHttpException $e) { |
276 | 276 | if ($e->getHttpStatus() === 404) { |
277 | - $this->statCache->clear($path . '/'); |
|
277 | + $this->statCache->clear($path.'/'); |
|
278 | 278 | $this->statCache->set($path, false); |
279 | 279 | return false; |
280 | 280 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $this->init(); |
332 | 332 | $path = $this->cleanPath($path); |
333 | 333 | $result = $this->simpleResponse('DELETE', $path, null, 204); |
334 | - $this->statCache->clear($path . '/'); |
|
334 | + $this->statCache->clear($path.'/'); |
|
335 | 335 | $this->statCache->remove($path); |
336 | 336 | return $result; |
337 | 337 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | try { |
347 | 347 | $response = $this->httpClientService |
348 | 348 | ->newClient() |
349 | - ->get($this->createBaseUri() . $this->encodePath($path), [ |
|
349 | + ->get($this->createBaseUri().$this->encodePath($path), [ |
|
350 | 350 | 'auth' => [$this->user, $this->password], |
351 | 351 | 'stream' => true |
352 | 352 | ]); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | if ($response->getStatusCode() === Http::STATUS_LOCKED) { |
364 | 364 | throw new \OCP\Lock\LockedException($path); |
365 | 365 | } else { |
366 | - Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), Util::ERROR); |
|
366 | + Util::writeLog("webdav client", 'Guzzle get returned status code '.$response->getStatusCode(), Util::ERROR); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $tmpFile = $tempManager->getTemporaryFile($ext); |
404 | 404 | } |
405 | 405 | $handle = fopen($tmpFile, $mode); |
406 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
406 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
407 | 407 | $this->writeBack($tmpFile, $path); |
408 | 408 | }); |
409 | 409 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | return FileInfo::SPACE_UNKNOWN; |
429 | 429 | } |
430 | 430 | if (isset($response['{DAV:}quota-available-bytes'])) { |
431 | - return (int)$response['{DAV:}quota-available-bytes']; |
|
431 | + return (int) $response['{DAV:}quota-available-bytes']; |
|
432 | 432 | } else { |
433 | 433 | return FileInfo::SPACE_UNKNOWN; |
434 | 434 | } |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | $this->httpClientService |
506 | 506 | ->newClient() |
507 | - ->put($this->createBaseUri() . $this->encodePath($target), [ |
|
507 | + ->put($this->createBaseUri().$this->encodePath($target), [ |
|
508 | 508 | 'body' => $source, |
509 | 509 | 'auth' => [$this->user, $this->password] |
510 | 510 | ]); |
@@ -521,18 +521,18 @@ discard block |
||
521 | 521 | // overwrite directory ? |
522 | 522 | if ($this->is_dir($path2)) { |
523 | 523 | // needs trailing slash in destination |
524 | - $path2 = rtrim($path2, '/') . '/'; |
|
524 | + $path2 = rtrim($path2, '/').'/'; |
|
525 | 525 | } |
526 | 526 | $this->client->request( |
527 | 527 | 'MOVE', |
528 | 528 | $this->encodePath($path1), |
529 | 529 | null, |
530 | 530 | [ |
531 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
531 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
532 | 532 | ] |
533 | 533 | ); |
534 | - $this->statCache->clear($path1 . '/'); |
|
535 | - $this->statCache->clear($path2 . '/'); |
|
534 | + $this->statCache->clear($path1.'/'); |
|
535 | + $this->statCache->clear($path2.'/'); |
|
536 | 536 | $this->statCache->set($path1, false); |
537 | 537 | $this->statCache->set($path2, true); |
538 | 538 | $this->removeCachedFile($path1); |
@@ -553,17 +553,17 @@ discard block |
||
553 | 553 | // overwrite directory ? |
554 | 554 | if ($this->is_dir($path2)) { |
555 | 555 | // needs trailing slash in destination |
556 | - $path2 = rtrim($path2, '/') . '/'; |
|
556 | + $path2 = rtrim($path2, '/').'/'; |
|
557 | 557 | } |
558 | 558 | $this->client->request( |
559 | 559 | 'COPY', |
560 | 560 | $this->encodePath($path1), |
561 | 561 | null, |
562 | 562 | [ |
563 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
563 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
564 | 564 | ] |
565 | 565 | ); |
566 | - $this->statCache->clear($path2 . '/'); |
|
566 | + $this->statCache->clear($path2.'/'); |
|
567 | 567 | $this->statCache->set($path2, true); |
568 | 568 | $this->removeCachedFile($path2); |
569 | 569 | return true; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | return [ |
584 | 584 | 'mtime' => strtotime($response['{DAV:}getlastmodified']), |
585 | - 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
585 | + 'size' => (int) isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
586 | 586 | ]; |
587 | 587 | } catch (\Exception $e) { |
588 | 588 | $this->convertException($e, $path); |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | return $response['statusCode'] == $expected; |
657 | 657 | } catch (ClientHttpException $e) { |
658 | 658 | if ($e->getHttpStatus() === 404 && $method === 'DELETE') { |
659 | - $this->statCache->clear($path . '/'); |
|
659 | + $this->statCache->clear($path.'/'); |
|
660 | 660 | $this->statCache->set($path, false); |
661 | 661 | return false; |
662 | 662 | } |
@@ -677,22 +677,22 @@ discard block |
||
677 | 677 | |
678 | 678 | /** {@inheritdoc} */ |
679 | 679 | public function isUpdatable($path) { |
680 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
680 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** {@inheritdoc} */ |
684 | 684 | public function isCreatable($path) { |
685 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
685 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** {@inheritdoc} */ |
689 | 689 | public function isSharable($path) { |
690 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
690 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | /** {@inheritdoc} */ |
694 | 694 | public function isDeletable($path) { |
695 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
695 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | /** {@inheritdoc} */ |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | if ($response === false) { |
769 | 769 | if ($path === '') { |
770 | 770 | // if root is gone it means the storage is not available |
771 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
771 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
772 | 772 | } |
773 | 773 | return false; |
774 | 774 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | if (!empty($etag) && $cachedData['etag'] !== $etag) { |
782 | 782 | return true; |
783 | 783 | } else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { |
784 | - $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
784 | + $sharePermissions = (int) $response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
785 | 785 | return $sharePermissions !== $cachedData['permissions']; |
786 | 786 | } else if (isset($response['{http://owncloud.org/ns}permissions'])) { |
787 | 787 | $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | if ($e->getHttpStatus() === 405) { |
798 | 798 | if ($path === '') { |
799 | 799 | // if root is gone it means the storage is not available |
800 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
800 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
801 | 801 | } |
802 | 802 | return false; |
803 | 803 | } |
@@ -832,19 +832,19 @@ discard block |
||
832 | 832 | } |
833 | 833 | if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) { |
834 | 834 | // either password was changed or was invalid all along |
835 | - throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage()); |
|
835 | + throw new StorageInvalidException(get_class($e).': '.$e->getMessage()); |
|
836 | 836 | } else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { |
837 | 837 | // ignore exception for MethodNotAllowed, false will be returned |
838 | 838 | return; |
839 | 839 | } |
840 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
840 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
841 | 841 | } else if ($e instanceof ClientException) { |
842 | 842 | // connection timeout or refused, server could be temporarily down |
843 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
843 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
844 | 844 | } else if ($e instanceof \InvalidArgumentException) { |
845 | 845 | // parse error because the server returned HTML instead of XML, |
846 | 846 | // possibly temporarily down |
847 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
847 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
848 | 848 | } else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { |
849 | 849 | // rethrow |
850 | 850 | throw $e; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { |
100 | 100 | // remote server revoked access to the address book, remove it |
101 | 101 | $this->backend->deleteAddressBook($addressBookId); |
102 | - $this->logger->info('Authorization failed, remove address book: ' . $url, ['app' => 'dav']); |
|
102 | + $this->logger->info('Authorization failed, remove address book: '.$url, ['app' => 'dav']); |
|
103 | 103 | throw $ex; |
104 | 104 | } |
105 | 105 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function getClient($url, $userName, $sharedSecret) { |
151 | 151 | $settings = [ |
152 | - 'baseUri' => $url . '/', |
|
152 | + 'baseUri' => $url.'/', |
|
153 | 153 | 'userName' => $userName, |
154 | 154 | 'password' => $sharedSecret, |
155 | 155 | ]; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function deleteUser($userOrCardId) { |
271 | 271 | $systemAddressBook = $this->getLocalSystemAddressBook(); |
272 | - if ($userOrCardId instanceof IUser){ |
|
272 | + if ($userOrCardId instanceof IUser) { |
|
273 | 273 | $name = $userOrCardId->getBackendClassName(); |
274 | 274 | $userId = $userOrCardId->getUID(); |
275 | 275 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | if (is_null($this->localSystemAddressBook)) { |
286 | 286 | $systemPrincipal = "principals/system/system"; |
287 | 287 | $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [ |
288 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
288 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
289 | 289 | ]); |
290 | 290 | } |
291 | 291 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | // remove no longer existing |
305 | 305 | $allCards = $this->backend->getCards($systemAddressBook['id']); |
306 | - foreach($allCards as $card) { |
|
306 | + foreach ($allCards as $card) { |
|
307 | 307 | $vCard = Reader::read($card['carddata']); |
308 | 308 | $uid = $vCard->UID->getValue(); |
309 | 309 | // load backend and see if user exists |