@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if (is_string($params['secure'])) { |
108 | 108 | $this->secure = ($params['secure'] === 'true'); |
109 | 109 | } else { |
110 | - $this->secure = (bool)$params['secure']; |
|
110 | + $this->secure = (bool) $params['secure']; |
|
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | $this->secure = false; |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | } |
121 | 121 | } |
122 | 122 | $this->root = $params['root'] ?? '/'; |
123 | - $this->root = '/' . ltrim($this->root, '/'); |
|
124 | - $this->root = rtrim($this->root, '/') . '/'; |
|
123 | + $this->root = '/'.ltrim($this->root, '/'); |
|
124 | + $this->root = rtrim($this->root, '/').'/'; |
|
125 | 125 | } else { |
126 | 126 | throw new \Exception('Invalid webdav storage configuration'); |
127 | 127 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->client = new Client($settings); |
151 | 151 | $this->client->setThrowExceptions(true); |
152 | 152 | |
153 | - if($this->secure === true) { |
|
153 | + if ($this->secure === true) { |
|
154 | 154 | $certPath = $this->certManager->getAbsoluteBundlePath(); |
155 | 155 | if (file_exists($certPath)) { |
156 | 156 | $this->certPath = $certPath; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | /** {@inheritdoc} */ |
172 | 172 | public function getId() { |
173 | - return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root; |
|
173 | + return 'webdav::'.$this->user.'@'.$this->host.'/'.$this->root; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** {@inheritdoc} */ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | if ($this->secure) { |
180 | 180 | $baseUri .= 's'; |
181 | 181 | } |
182 | - $baseUri .= '://' . $this->host . $this->root; |
|
182 | + $baseUri .= '://'.$this->host.$this->root; |
|
183 | 183 | return $baseUri; |
184 | 184 | } |
185 | 185 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | $path = $this->cleanPath($path); |
201 | 201 | // FIXME: some WebDAV impl return 403 when trying to DELETE |
202 | 202 | // a non-empty folder |
203 | - $result = $this->simpleResponse('DELETE', $path . '/', null, 204); |
|
204 | - $this->statCache->clear($path . '/'); |
|
203 | + $result = $this->simpleResponse('DELETE', $path.'/', null, 204); |
|
204 | + $this->statCache->clear($path.'/'); |
|
205 | 205 | $this->statCache->remove($path); |
206 | 206 | return $result; |
207 | 207 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $this->statCache->set($path, $response); |
277 | 277 | } catch (ClientHttpException $e) { |
278 | 278 | if ($e->getHttpStatus() === 404 || $e->getHttpStatus() === 405) { |
279 | - $this->statCache->clear($path . '/'); |
|
279 | + $this->statCache->clear($path.'/'); |
|
280 | 280 | $this->statCache->set($path, false); |
281 | 281 | return false; |
282 | 282 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $this->init(); |
334 | 334 | $path = $this->cleanPath($path); |
335 | 335 | $result = $this->simpleResponse('DELETE', $path, null, 204); |
336 | - $this->statCache->clear($path . '/'); |
|
336 | + $this->statCache->clear($path.'/'); |
|
337 | 337 | $this->statCache->remove($path); |
338 | 338 | return $result; |
339 | 339 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | try { |
349 | 349 | $response = $this->httpClientService |
350 | 350 | ->newClient() |
351 | - ->get($this->createBaseUri() . $this->encodePath($path), [ |
|
351 | + ->get($this->createBaseUri().$this->encodePath($path), [ |
|
352 | 352 | 'auth' => [$this->user, $this->password], |
353 | 353 | 'stream' => true |
354 | 354 | ]); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | if ($response->getStatusCode() === Http::STATUS_LOCKED) { |
366 | 366 | throw new \OCP\Lock\LockedException($path); |
367 | 367 | } else { |
368 | - Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), ILogger::ERROR); |
|
368 | + Util::writeLog("webdav client", 'Guzzle get returned status code '.$response->getStatusCode(), ILogger::ERROR); |
|
369 | 369 | } |
370 | 370 | } |
371 | 371 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $tmpFile = $tempManager->getTemporaryFile($ext); |
406 | 406 | } |
407 | 407 | $handle = fopen($tmpFile, $mode); |
408 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
408 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
409 | 409 | $this->writeBack($tmpFile, $path); |
410 | 410 | }); |
411 | 411 | } |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | return FileInfo::SPACE_UNKNOWN; |
431 | 431 | } |
432 | 432 | if (isset($response['{DAV:}quota-available-bytes'])) { |
433 | - return (int)$response['{DAV:}quota-available-bytes']; |
|
433 | + return (int) $response['{DAV:}quota-available-bytes']; |
|
434 | 434 | } else { |
435 | 435 | return FileInfo::SPACE_UNKNOWN; |
436 | 436 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | |
507 | 507 | $this->httpClientService |
508 | 508 | ->newClient() |
509 | - ->put($this->createBaseUri() . $this->encodePath($target), [ |
|
509 | + ->put($this->createBaseUri().$this->encodePath($target), [ |
|
510 | 510 | 'body' => $source, |
511 | 511 | 'auth' => [$this->user, $this->password] |
512 | 512 | ]); |
@@ -523,18 +523,18 @@ discard block |
||
523 | 523 | // overwrite directory ? |
524 | 524 | if ($this->is_dir($path2)) { |
525 | 525 | // needs trailing slash in destination |
526 | - $path2 = rtrim($path2, '/') . '/'; |
|
526 | + $path2 = rtrim($path2, '/').'/'; |
|
527 | 527 | } |
528 | 528 | $this->client->request( |
529 | 529 | 'MOVE', |
530 | 530 | $this->encodePath($path1), |
531 | 531 | null, |
532 | 532 | [ |
533 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
533 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
534 | 534 | ] |
535 | 535 | ); |
536 | - $this->statCache->clear($path1 . '/'); |
|
537 | - $this->statCache->clear($path2 . '/'); |
|
536 | + $this->statCache->clear($path1.'/'); |
|
537 | + $this->statCache->clear($path2.'/'); |
|
538 | 538 | $this->statCache->set($path1, false); |
539 | 539 | $this->statCache->set($path2, true); |
540 | 540 | $this->removeCachedFile($path1); |
@@ -555,17 +555,17 @@ discard block |
||
555 | 555 | // overwrite directory ? |
556 | 556 | if ($this->is_dir($path2)) { |
557 | 557 | // needs trailing slash in destination |
558 | - $path2 = rtrim($path2, '/') . '/'; |
|
558 | + $path2 = rtrim($path2, '/').'/'; |
|
559 | 559 | } |
560 | 560 | $this->client->request( |
561 | 561 | 'COPY', |
562 | 562 | $this->encodePath($path1), |
563 | 563 | null, |
564 | 564 | [ |
565 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
565 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
566 | 566 | ] |
567 | 567 | ); |
568 | - $this->statCache->clear($path2 . '/'); |
|
568 | + $this->statCache->clear($path2.'/'); |
|
569 | 569 | $this->statCache->set($path2, true); |
570 | 570 | $this->removeCachedFile($path2); |
571 | 571 | return true; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | } |
585 | 585 | return [ |
586 | 586 | 'mtime' => strtotime($response['{DAV:}getlastmodified']), |
587 | - 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
587 | + 'size' => (int) isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
588 | 588 | ]; |
589 | 589 | } catch (\Exception $e) { |
590 | 590 | $this->convertException($e, $path); |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | return $response['statusCode'] == $expected; |
667 | 667 | } catch (ClientHttpException $e) { |
668 | 668 | if ($e->getHttpStatus() === 404 && $method === 'DELETE') { |
669 | - $this->statCache->clear($path . '/'); |
|
669 | + $this->statCache->clear($path.'/'); |
|
670 | 670 | $this->statCache->set($path, false); |
671 | 671 | return false; |
672 | 672 | } |
@@ -687,22 +687,22 @@ discard block |
||
687 | 687 | |
688 | 688 | /** {@inheritdoc} */ |
689 | 689 | public function isUpdatable($path) { |
690 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
690 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | /** {@inheritdoc} */ |
694 | 694 | public function isCreatable($path) { |
695 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
695 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | /** {@inheritdoc} */ |
699 | 699 | public function isSharable($path) { |
700 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
700 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | /** {@inheritdoc} */ |
704 | 704 | public function isDeletable($path) { |
705 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
705 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | /** {@inheritdoc} */ |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | if (!empty($etag) && $cachedData['etag'] !== $etag) { |
796 | 796 | return true; |
797 | 797 | } else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { |
798 | - $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
798 | + $sharePermissions = (int) $response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
799 | 799 | return $sharePermissions !== $cachedData['permissions']; |
800 | 800 | } else if (isset($response['{http://owncloud.org/ns}permissions'])) { |
801 | 801 | $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | if ($e->getHttpStatus() === 405) { |
812 | 812 | if ($path === '') { |
813 | 813 | // if root is gone it means the storage is not available |
814 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
814 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
815 | 815 | } |
816 | 816 | return false; |
817 | 817 | } |
@@ -846,22 +846,22 @@ discard block |
||
846 | 846 | } |
847 | 847 | if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) { |
848 | 848 | // either password was changed or was invalid all along |
849 | - throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage()); |
|
849 | + throw new StorageInvalidException(get_class($e).': '.$e->getMessage()); |
|
850 | 850 | } else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { |
851 | 851 | // ignore exception for MethodNotAllowed, false will be returned |
852 | 852 | return; |
853 | - } else if ($e->getHttpStatus() === Http::STATUS_FORBIDDEN){ |
|
853 | + } else if ($e->getHttpStatus() === Http::STATUS_FORBIDDEN) { |
|
854 | 854 | // The operation is forbidden. Fail somewhat gracefully |
855 | - throw new ForbiddenException(get_class($e) . ':' . $e->getMessage()); |
|
855 | + throw new ForbiddenException(get_class($e).':'.$e->getMessage()); |
|
856 | 856 | } |
857 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
857 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
858 | 858 | } else if ($e instanceof ClientException) { |
859 | 859 | // connection timeout or refused, server could be temporarily down |
860 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
860 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
861 | 861 | } else if ($e instanceof \InvalidArgumentException) { |
862 | 862 | // parse error because the server returned HTML instead of XML, |
863 | 863 | // possibly temporarily down |
864 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
864 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
865 | 865 | } else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { |
866 | 866 | // rethrow |
867 | 867 | throw $e; |