@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if (is_string($params['secure'])) { |
| 104 | 104 | $this->secure = ($params['secure'] === 'true'); |
| 105 | 105 | } else { |
| 106 | - $this->secure = (bool)$params['secure']; |
|
| 106 | + $this->secure = (bool) $params['secure']; |
|
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | 109 | $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 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | /** {@inheritdoc} */ |
| 165 | 165 | public function getId() { |
| 166 | - return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root; |
|
| 166 | + return 'webdav::'.$this->user.'@'.$this->host.'/'.$this->root; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** {@inheritdoc} */ |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | if ($this->secure) { |
| 173 | 173 | $baseUri .= 's'; |
| 174 | 174 | } |
| 175 | - $baseUri .= '://' . $this->host . $this->root; |
|
| 175 | + $baseUri .= '://'.$this->host.$this->root; |
|
| 176 | 176 | return $baseUri; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | $path = $this->cleanPath($path); |
| 194 | 194 | // FIXME: some WebDAV impl return 403 when trying to DELETE |
| 195 | 195 | // a non-empty folder |
| 196 | - $result = $this->simpleResponse('DELETE', $path . '/', null, 204); |
|
| 197 | - $this->statCache->clear($path . '/'); |
|
| 196 | + $result = $this->simpleResponse('DELETE', $path.'/', null, 204); |
|
| 197 | + $this->statCache->clear($path.'/'); |
|
| 198 | 198 | $this->statCache->remove($path); |
| 199 | 199 | return $result; |
| 200 | 200 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $this->statCache->set($path, $response); |
| 270 | 270 | } catch (ClientHttpException $e) { |
| 271 | 271 | if ($e->getHttpStatus() === 404 || $e->getHttpStatus() === 405) { |
| 272 | - $this->statCache->clear($path . '/'); |
|
| 272 | + $this->statCache->clear($path.'/'); |
|
| 273 | 273 | $this->statCache->set($path, false); |
| 274 | 274 | return false; |
| 275 | 275 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $this->init(); |
| 327 | 327 | $path = $this->cleanPath($path); |
| 328 | 328 | $result = $this->simpleResponse('DELETE', $path, null, 204); |
| 329 | - $this->statCache->clear($path . '/'); |
|
| 329 | + $this->statCache->clear($path.'/'); |
|
| 330 | 330 | $this->statCache->remove($path); |
| 331 | 331 | return $result; |
| 332 | 332 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | try { |
| 342 | 342 | $response = $this->httpClientService |
| 343 | 343 | ->newClient() |
| 344 | - ->get($this->createBaseUri() . $this->encodePath($path), [ |
|
| 344 | + ->get($this->createBaseUri().$this->encodePath($path), [ |
|
| 345 | 345 | 'auth' => [$this->user, $this->password], |
| 346 | 346 | 'stream' => true |
| 347 | 347 | ]); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | if ($response->getStatusCode() === Http::STATUS_LOCKED) { |
| 359 | 359 | throw new \OCP\Lock\LockedException($path); |
| 360 | 360 | } else { |
| 361 | - Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), ILogger::ERROR); |
|
| 361 | + Util::writeLog("webdav client", 'Guzzle get returned status code '.$response->getStatusCode(), ILogger::ERROR); |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $tmpFile = $tempManager->getTemporaryFile($ext); |
| 399 | 399 | } |
| 400 | 400 | $handle = fopen($tmpFile, $mode); |
| 401 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
| 401 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
| 402 | 402 | $this->writeBack($tmpFile, $path); |
| 403 | 403 | }); |
| 404 | 404 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | return FileInfo::SPACE_UNKNOWN; |
| 424 | 424 | } |
| 425 | 425 | if (isset($response['{DAV:}quota-available-bytes'])) { |
| 426 | - return (int)$response['{DAV:}quota-available-bytes']; |
|
| 426 | + return (int) $response['{DAV:}quota-available-bytes']; |
|
| 427 | 427 | } else { |
| 428 | 428 | return FileInfo::SPACE_UNKNOWN; |
| 429 | 429 | } |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | $this->httpClientService |
| 501 | 501 | ->newClient() |
| 502 | - ->put($this->createBaseUri() . $this->encodePath($target), [ |
|
| 502 | + ->put($this->createBaseUri().$this->encodePath($target), [ |
|
| 503 | 503 | 'body' => $source, |
| 504 | 504 | 'auth' => [$this->user, $this->password] |
| 505 | 505 | ]); |
@@ -516,18 +516,18 @@ discard block |
||
| 516 | 516 | // overwrite directory ? |
| 517 | 517 | if ($this->is_dir($path2)) { |
| 518 | 518 | // needs trailing slash in destination |
| 519 | - $path2 = rtrim($path2, '/') . '/'; |
|
| 519 | + $path2 = rtrim($path2, '/').'/'; |
|
| 520 | 520 | } |
| 521 | 521 | $this->client->request( |
| 522 | 522 | 'MOVE', |
| 523 | 523 | $this->encodePath($path1), |
| 524 | 524 | null, |
| 525 | 525 | [ |
| 526 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
| 526 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
| 527 | 527 | ] |
| 528 | 528 | ); |
| 529 | - $this->statCache->clear($path1 . '/'); |
|
| 530 | - $this->statCache->clear($path2 . '/'); |
|
| 529 | + $this->statCache->clear($path1.'/'); |
|
| 530 | + $this->statCache->clear($path2.'/'); |
|
| 531 | 531 | $this->statCache->set($path1, false); |
| 532 | 532 | $this->statCache->set($path2, true); |
| 533 | 533 | $this->removeCachedFile($path1); |
@@ -548,17 +548,17 @@ discard block |
||
| 548 | 548 | // overwrite directory ? |
| 549 | 549 | if ($this->is_dir($path2)) { |
| 550 | 550 | // needs trailing slash in destination |
| 551 | - $path2 = rtrim($path2, '/') . '/'; |
|
| 551 | + $path2 = rtrim($path2, '/').'/'; |
|
| 552 | 552 | } |
| 553 | 553 | $this->client->request( |
| 554 | 554 | 'COPY', |
| 555 | 555 | $this->encodePath($path1), |
| 556 | 556 | null, |
| 557 | 557 | [ |
| 558 | - 'Destination' => $this->createBaseUri() . $this->encodePath($path2), |
|
| 558 | + 'Destination' => $this->createBaseUri().$this->encodePath($path2), |
|
| 559 | 559 | ] |
| 560 | 560 | ); |
| 561 | - $this->statCache->clear($path2 . '/'); |
|
| 561 | + $this->statCache->clear($path2.'/'); |
|
| 562 | 562 | $this->statCache->set($path2, true); |
| 563 | 563 | $this->removeCachedFile($path2); |
| 564 | 564 | return true; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | return [ |
| 579 | 579 | 'mtime' => strtotime($response['{DAV:}getlastmodified']), |
| 580 | - 'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
| 580 | + 'size' => (int) isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0, |
|
| 581 | 581 | ]; |
| 582 | 582 | } catch (\Exception $e) { |
| 583 | 583 | $this->convertException($e, $path); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | return $response['statusCode'] == $expected; |
| 660 | 660 | } catch (ClientHttpException $e) { |
| 661 | 661 | if ($e->getHttpStatus() === 404 && $method === 'DELETE') { |
| 662 | - $this->statCache->clear($path . '/'); |
|
| 662 | + $this->statCache->clear($path.'/'); |
|
| 663 | 663 | $this->statCache->set($path, false); |
| 664 | 664 | return false; |
| 665 | 665 | } |
@@ -680,22 +680,22 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | /** {@inheritdoc} */ |
| 682 | 682 | public function isUpdatable($path) { |
| 683 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
| 683 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_UPDATE); |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | /** {@inheritdoc} */ |
| 687 | 687 | public function isCreatable($path) { |
| 688 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
| 688 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_CREATE); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | /** {@inheritdoc} */ |
| 692 | 692 | public function isSharable($path) { |
| 693 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
| 693 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | /** {@inheritdoc} */ |
| 697 | 697 | public function isDeletable($path) { |
| 698 | - return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
| 698 | + return (bool) ($this->getPermissions($path) & Constants::PERMISSION_DELETE); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | /** {@inheritdoc} */ |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | if (!empty($etag) && $cachedData['etag'] !== $etag) { |
| 789 | 789 | return true; |
| 790 | 790 | } else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { |
| 791 | - $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
| 791 | + $sharePermissions = (int) $response['{http://open-collaboration-services.org/ns}share-permissions']; |
|
| 792 | 792 | return $sharePermissions !== $cachedData['permissions']; |
| 793 | 793 | } else if (isset($response['{http://owncloud.org/ns}permissions'])) { |
| 794 | 794 | $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | if ($e->getHttpStatus() === 405) { |
| 805 | 805 | if ($path === '') { |
| 806 | 806 | // if root is gone it means the storage is not available |
| 807 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
| 807 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
| 808 | 808 | } |
| 809 | 809 | return false; |
| 810 | 810 | } |
@@ -838,19 +838,19 @@ discard block |
||
| 838 | 838 | } |
| 839 | 839 | if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) { |
| 840 | 840 | // either password was changed or was invalid all along |
| 841 | - throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage()); |
|
| 841 | + throw new StorageInvalidException(get_class($e).': '.$e->getMessage()); |
|
| 842 | 842 | } else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { |
| 843 | 843 | // ignore exception for MethodNotAllowed, false will be returned |
| 844 | 844 | return; |
| 845 | 845 | } |
| 846 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
| 846 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
| 847 | 847 | } else if ($e instanceof ClientException) { |
| 848 | 848 | // connection timeout or refused, server could be temporarily down |
| 849 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
| 849 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
| 850 | 850 | } else if ($e instanceof \InvalidArgumentException) { |
| 851 | 851 | // parse error because the server returned HTML instead of XML, |
| 852 | 852 | // possibly temporarily down |
| 853 | - throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); |
|
| 853 | + throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage()); |
|
| 854 | 854 | } else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { |
| 855 | 855 | // rethrow |
| 856 | 856 | throw $e; |