@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * @copyright Copyright (c) 2018 Robin Appelman <[email protected]> |
| 5 | 5 | * |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | private function getCachedToken(string $cacheKey) { |
| 54 | - $cachedTokenString = $this->cache->get($cacheKey . '/token'); |
|
| 54 | + $cachedTokenString = $this->cache->get($cacheKey.'/token'); |
|
| 55 | 55 | if ($cachedTokenString) { |
| 56 | 56 | return json_decode($cachedTokenString); |
| 57 | 57 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | private function cacheToken(Token $token, string $cacheKey) { |
| 63 | - $this->cache->set($cacheKey . '/token', json_encode($token)); |
|
| 63 | + $this->cache->set($cacheKey.'/token', json_encode($token)); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $this->params['tenantName'] = $this->params['tenant']; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $cacheKey = $userName . '@' . $this->params['url'] . '/' . $this->params['bucket']; |
|
| 93 | + $cacheKey = $userName.'@'.$this->params['url'].'/'.$this->params['bucket']; |
|
| 94 | 94 | $token = $this->getCachedToken($cacheKey); |
| 95 | 95 | $hasToken = is_array($token) && (new \DateTimeImmutable($token['expires_at'])) > (new \DateTimeImmutable('now')); |
| 96 | 96 | if ($hasToken) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } catch (ConnectException $e) { |
| 187 | 187 | /** @var RequestInterface $request */ |
| 188 | 188 | $request = $e->getRequest(); |
| 189 | - $host = $request->getUri()->getHost() . ':' . $request->getUri()->getPort(); |
|
| 189 | + $host = $request->getUri()->getHost().':'.$request->getUri()->getPort(); |
|
| 190 | 190 | \OC::$server->getLogger()->error("Can't connect to object storage server at $host"); |
| 191 | 191 | throw new StorageNotAvailableException("Can't connect to object storage server at $host", StorageNotAvailableException::STATUS_ERROR, $e); |
| 192 | 192 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * @copyright Copyright (c) 2018 Robin Appelman <[email protected]> |
| 5 | 5 | * |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | /** |
| 4 | 4 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
| 5 | 5 | * |
@@ -163,12 +163,12 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $user = $params['user']; |
| 166 | - $this->id = 'swift::' . $user . md5($params['bucket']); |
|
| 166 | + $this->id = 'swift::'.$user.md5($params['bucket']); |
|
| 167 | 167 | |
| 168 | 168 | $bucketUrl = new Uri($params['bucket']); |
| 169 | 169 | if ($bucketUrl->getHost()) { |
| 170 | 170 | $params['bucket'] = basename($bucketUrl->getPath()); |
| 171 | - $params['endpoint_url'] = (string)$bucketUrl->withPath(dirname($bucketUrl->getPath())); |
|
| 171 | + $params['endpoint_url'] = (string) $bucketUrl->withPath(dirname($bucketUrl->getPath())); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if (empty($params['url'])) { |
@@ -253,16 +253,16 @@ discard block |
||
| 253 | 253 | continue; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if ($this->is_dir($path . '/' . $file)) { |
|
| 257 | - $this->rmdir($path . '/' . $file); |
|
| 256 | + if ($this->is_dir($path.'/'.$file)) { |
|
| 257 | + $this->rmdir($path.'/'.$file); |
|
| 258 | 258 | } else { |
| 259 | - $this->unlink($path . '/' . $file); |
|
| 259 | + $this->unlink($path.'/'.$file); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | try { |
| 264 | - $this->objectStore->deleteObject($path . '/'); |
|
| 265 | - $this->objectCache->remove($path . '/'); |
|
| 264 | + $this->objectStore->deleteObject($path.'/'); |
|
| 265 | + $this->objectCache->remove($path.'/'); |
|
| 266 | 266 | } catch (BadResponseError $e) { |
| 267 | 267 | \OC::$server->getLogger()->logException($e, [ |
| 268 | 268 | 'level' => \OCP\Util::ERROR, |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $stat = array(); |
| 348 | - $stat['size'] = (int)$object->contentLength; |
|
| 348 | + $stat['size'] = (int) $object->contentLength; |
|
| 349 | 349 | $stat['mtime'] = $mtime; |
| 350 | 350 | $stat['atime'] = time(); |
| 351 | 351 | return $stat; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | try { |
| 378 | 378 | $this->objectStore->deleteObject($path); |
| 379 | 379 | $this->objectCache->remove($path); |
| 380 | - $this->objectCache->remove($path . '/'); |
|
| 380 | + $this->objectCache->remove($path.'/'); |
|
| 381 | 381 | } catch (BadResponseError $e) { |
| 382 | 382 | if ($e->getResponse()->getStatusCode() !== 404) { |
| 383 | 383 | \OC::$server->getLogger()->logException($e, [ |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | file_put_contents($tmpFile, $source); |
| 436 | 436 | } |
| 437 | 437 | $handle = fopen($tmpFile, $mode); |
| 438 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
| 438 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
| 439 | 439 | $this->writeBack($tmpFile, $path); |
| 440 | 440 | }); |
| 441 | 441 | } |
@@ -485,11 +485,11 @@ discard block |
||
| 485 | 485 | try { |
| 486 | 486 | $source = $this->fetchObject($path1); |
| 487 | 487 | $source->copy([ |
| 488 | - 'destination' => $this->bucket . '/' . $path2 |
|
| 488 | + 'destination' => $this->bucket.'/'.$path2 |
|
| 489 | 489 | ]); |
| 490 | 490 | // invalidate target object to force repopulation on fetch |
| 491 | 491 | $this->objectCache->remove($path2); |
| 492 | - $this->objectCache->remove($path2 . '/'); |
|
| 492 | + $this->objectCache->remove($path2.'/'); |
|
| 493 | 493 | } catch (BadResponseError $e) { |
| 494 | 494 | \OC::$server->getLogger()->logException($e, [ |
| 495 | 495 | 'level' => \OCP\Util::ERROR, |
@@ -500,13 +500,13 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | } else if ($fileType === 'dir') { |
| 502 | 502 | try { |
| 503 | - $source = $this->fetchObject($path1 . '/'); |
|
| 503 | + $source = $this->fetchObject($path1.'/'); |
|
| 504 | 504 | $source->copy([ |
| 505 | - 'destination' => $this->bucket . '/' . $path2 . '/' |
|
| 505 | + 'destination' => $this->bucket.'/'.$path2.'/' |
|
| 506 | 506 | ]); |
| 507 | 507 | // invalidate target object to force repopulation on fetch |
| 508 | 508 | $this->objectCache->remove($path2); |
| 509 | - $this->objectCache->remove($path2 . '/'); |
|
| 509 | + $this->objectCache->remove($path2.'/'); |
|
| 510 | 510 | } catch (BadResponseError $e) { |
| 511 | 511 | \OC::$server->getLogger()->logException($e, [ |
| 512 | 512 | 'level' => \OCP\Util::ERROR, |
@@ -521,8 +521,8 @@ discard block |
||
| 521 | 521 | continue; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - $source = $path1 . '/' . $file; |
|
| 525 | - $target = $path2 . '/' . $file; |
|
| 524 | + $source = $path1.'/'.$file; |
|
| 525 | + $target = $path2.'/'.$file; |
|
| 526 | 526 | $this->copy($source, $target); |
| 527 | 527 | } |
| 528 | 528 | |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | $path = ''; |
| 604 | 604 | } |
| 605 | 605 | $cachedContent = $this->getCache()->getFolderContents($path); |
| 606 | - $cachedNames = array_map(function ($content) { |
|
| 606 | + $cachedNames = array_map(function($content) { |
|
| 607 | 607 | return $content['name']; |
| 608 | 608 | }, $cachedContent); |
| 609 | 609 | sort($cachedNames); |