Completed
Pull Request — master (#8314)
by Robin
15:50
created
lib/private/Files/ObjectStore/SwiftFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
  *
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	private function getCachedToken(string $cacheKey) {
53
-		$cachedTokenString = $this->cache->get($cacheKey . '/token');
53
+		$cachedTokenString = $this->cache->get($cacheKey.'/token');
54 54
 		if ($cachedTokenString) {
55 55
 			return json_decode($cachedTokenString);
56 56
 		} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	private function cacheToken(Token $token, string $cacheKey) {
62
-		$this->cache->set($cacheKey . '/token', json_encode($token));
62
+		$this->cache->set($cacheKey.'/token', json_encode($token));
63 63
 	}
64 64
 
65 65
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			$this->params['tenantName'] = $this->params['tenant'];
85 85
 		}
86 86
 
87
-		$cacheKey = $this->params['username'] . '@' . $this->params['url'] . '/' . $this->params['bucket'];
87
+		$cacheKey = $this->params['username'].'@'.$this->params['url'].'/'.$this->params['bucket'];
88 88
 		$token = $this->getCachedToken($cacheKey);
89 89
 		$hasToken = is_array($token) && (new \DateTimeImmutable($token['expires_at'])) > (new \DateTimeImmutable('now'));
90 90
 		if ($hasToken) {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		} catch (ConnectException $e) {
167 167
 			/** @var RequestInterface $request */
168 168
 			$request = $e->getRequest();
169
-			$host = $request->getUri()->getHost() . ':' . $request->getUri()->getPort();
169
+			$host = $request->getUri()->getHost().':'.$request->getUri()->getPort();
170 170
 			\OC::$server->getLogger()->error("Can't connect to object storage server at $host");
171 171
 			throw new StorageNotAvailableException("Can't connect to object storage server at $host", StorageNotAvailableException::STATUS_ERROR, $e);
172 172
 		}
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Storage/Swift.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
  *
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 			throw new StorageBadConfigException("API Key or password, Username, Bucket and Region have to be configured.");
163 163
 		}
164 164
 
165
-		$this->id = 'swift::' . $params['user'] . md5($params['bucket']);
165
+		$this->id = 'swift::'.$params['user'].md5($params['bucket']);
166 166
 
167 167
 		$bucketUrl = new Uri($params['bucket']);
168 168
 		if ($bucketUrl->getHost()) {
169 169
 			$params['bucket'] = basename($bucketUrl->getPath());
170
-			$params['endpoint_url'] = (string)$bucketUrl->withPath(dirname($bucketUrl->getPath()));
170
+			$params['endpoint_url'] = (string) $bucketUrl->withPath(dirname($bucketUrl->getPath()));
171 171
 		}
172 172
 
173 173
 		if (empty($params['url'])) {
@@ -242,16 +242,16 @@  discard block
 block discarded – undo
242 242
 				continue;
243 243
 			}
244 244
 
245
-			if ($this->is_dir($path . '/' . $file)) {
246
-				$this->rmdir($path . '/' . $file);
245
+			if ($this->is_dir($path.'/'.$file)) {
246
+				$this->rmdir($path.'/'.$file);
247 247
 			} else {
248
-				$this->unlink($path . '/' . $file);
248
+				$this->unlink($path.'/'.$file);
249 249
 			}
250 250
 		}
251 251
 
252 252
 		try {
253
-			$this->objectStore->deleteObject($path . '/');
254
-			$this->objectCache->remove($path . '/');
253
+			$this->objectStore->deleteObject($path.'/');
254
+			$this->objectCache->remove($path.'/');
255 255
 		} catch (BadResponseError $e) {
256 256
 			\OC::$server->getLogger()->logException($e, [
257 257
 				'level' => \OCP\Util::ERROR,
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		}
335 335
 
336 336
 		$stat = array();
337
-		$stat['size'] = (int)$object->contentLength;
337
+		$stat['size'] = (int) $object->contentLength;
338 338
 		$stat['mtime'] = $mtime;
339 339
 		$stat['atime'] = time();
340 340
 		return $stat;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		try {
367 367
 			$this->objectStore->deleteObject($path);
368 368
 			$this->objectCache->remove($path);
369
-			$this->objectCache->remove($path . '/');
369
+			$this->objectCache->remove($path.'/');
370 370
 		} catch (BadResponseError $e) {
371 371
 			if ($e->getResponse()->getStatusCode() !== 404) {
372 372
 				\OC::$server->getLogger()->logException($e, [
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 					file_put_contents($tmpFile, $source);
425 425
 				}
426 426
 				$handle = fopen($tmpFile, $mode);
427
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
427
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
428 428
 					$this->writeBack($tmpFile, $path);
429 429
 				});
430 430
 		}
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 			try {
475 475
 				$source = $this->fetchObject($path1);
476 476
 				$source->copy([
477
-					'destination' => $this->bucket . '/' . $path2
477
+					'destination' => $this->bucket.'/'.$path2
478 478
 				]);
479 479
 				// invalidate target object to force repopulation on fetch
480 480
 				$this->objectCache->remove($path2);
481
-				$this->objectCache->remove($path2 . '/');
481
+				$this->objectCache->remove($path2.'/');
482 482
 			} catch (BadResponseError $e) {
483 483
 				\OC::$server->getLogger()->logException($e, [
484 484
 					'level' => \OCP\Util::ERROR,
@@ -489,13 +489,13 @@  discard block
 block discarded – undo
489 489
 
490 490
 		} else if ($fileType === 'dir') {
491 491
 			try {
492
-				$source = $this->fetchObject($path1 . '/');
492
+				$source = $this->fetchObject($path1.'/');
493 493
 				$source->copy([
494
-					'destination' => $this->bucket . '/' . $path2 . '/'
494
+					'destination' => $this->bucket.'/'.$path2.'/'
495 495
 				]);
496 496
 				// invalidate target object to force repopulation on fetch
497 497
 				$this->objectCache->remove($path2);
498
-				$this->objectCache->remove($path2 . '/');
498
+				$this->objectCache->remove($path2.'/');
499 499
 			} catch (BadResponseError $e) {
500 500
 				\OC::$server->getLogger()->logException($e, [
501 501
 					'level' => \OCP\Util::ERROR,
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
 					continue;
511 511
 				}
512 512
 
513
-				$source = $path1 . '/' . $file;
514
-				$target = $path2 . '/' . $file;
513
+				$source = $path1.'/'.$file;
514
+				$target = $path2.'/'.$file;
515 515
 				$this->copy($source, $target);
516 516
 			}
517 517
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 			$path = '';
593 593
 		}
594 594
 		$cachedContent = $this->getCache()->getFolderContents($path);
595
-		$cachedNames = array_map(function ($content) {
595
+		$cachedNames = array_map(function($content) {
596 596
 			return $content['name'];
597 597
 		}, $cachedContent);
598 598
 		sort($cachedNames);
Please login to merge, or discard this patch.