Passed
Push — master ( 422044...b2e342 )
by Blizzz
18:52 queued 13s
created
lib/private/Files/ObjectStore/ObjectStoreStorage.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 			throw new \Exception('missing IObjectStore instance');
78 78
 		}
79 79
 		if (isset($params['storageid'])) {
80
-			$this->id = 'object::store:' . $params['storageid'];
80
+			$this->id = 'object::store:'.$params['storageid'];
81 81
 		} else {
82
-			$this->id = 'object::store:' . $this->objectStore->getStorageId();
82
+			$this->id = 'object::store:'.$this->objectStore->getStorageId();
83 83
 		}
84 84
 		if (isset($params['objectPrefix'])) {
85 85
 			$this->objectPrefix = $params['objectPrefix'];
86 86
 		}
87 87
 		if (isset($params['validateWrites'])) {
88
-			$this->validateWrites = (bool)$params['validateWrites'];
88
+			$this->validateWrites = (bool) $params['validateWrites'];
89 89
 		}
90 90
 
91 91
 		$this->logger = \OC::$server->getLogger();
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			if ($ex->getCode() !== 404) {
227 227
 				$this->logger->logException($ex, [
228 228
 					'app' => 'objectstore',
229
-					'message' => 'Could not delete object ' . $this->getURN($entry->getId()) . ' for ' . $entry->getPath(),
229
+					'message' => 'Could not delete object '.$this->getURN($entry->getId()).' for '.$entry->getPath(),
230 230
 				]);
231 231
 				return false;
232 232
 			}
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	public function getURN($fileId) {
275 275
 		if (is_numeric($fileId)) {
276
-			return $this->objectPrefix . $fileId;
276
+			return $this->objectPrefix.$fileId;
277 277
 		}
278 278
 		return null;
279 279
 	}
@@ -336,19 +336,19 @@  discard block
 block discarded – undo
336 336
 						$streamStat = fstat($handle);
337 337
 						$actualSize = $streamStat['size'] ?? -1;
338 338
 						if ($actualSize > -1 && $actualSize !== $filesize) {
339
-							$this->getCache()->update((int)$stat['fileid'], ['size' => $actualSize]);
339
+							$this->getCache()->update((int) $stat['fileid'], ['size' => $actualSize]);
340 340
 						}
341 341
 						return $handle;
342 342
 					} catch (NotFoundException $e) {
343 343
 						$this->logger->logException($e, [
344 344
 							'app' => 'objectstore',
345
-							'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
345
+							'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path,
346 346
 						]);
347 347
 						throw $e;
348 348
 					} catch (\Exception $ex) {
349 349
 						$this->logger->logException($ex, [
350 350
 							'app' => 'objectstore',
351
-							'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
351
+							'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path,
352 352
 						]);
353 353
 						return false;
354 354
 					}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
 				$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
370 370
 				$handle = fopen($tmpFile, $mode);
371
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
371
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
372 372
 					$this->writeBack($tmpFile, $path);
373 373
 					unlink($tmpFile);
374 374
 				});
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 					file_put_contents($tmpFile, $source);
387 387
 				}
388 388
 				$handle = fopen($tmpFile, $mode);
389
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
389
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
390 390
 					$this->writeBack($tmpFile, $path);
391 391
 					unlink($tmpFile);
392 392
 				});
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 	public function file_exists($path) {
398 398
 		$path = $this->normalizePath($path);
399
-		return (bool)$this->stat($path);
399
+		return (bool) $this->stat($path);
400 400
 	}
401 401
 
402 402
 	public function rename($source, $target) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 			} catch (\Exception $ex) {
449 449
 				$this->logger->logException($ex, [
450 450
 					'app' => 'objectstore',
451
-					'message' => 'Could not create object for ' . $path,
451
+					'message' => 'Could not create object for '.$path,
452 452
 				]);
453 453
 				throw $ex;
454 454
 			}
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		}
497 497
 		// update stat with new data
498 498
 		$mTime = time();
499
-		$stat['size'] = (int)$size;
499
+		$stat['size'] = (int) $size;
500 500
 		$stat['mtime'] = $mTime;
501 501
 		$stat['storage_mtime'] = $mTime;
502 502
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$stat['checksum'] = '';
509 509
 
510 510
 		$exists = $this->getCache()->inCache($path);
511
-		$uploadPath = $exists ? $path : $path . '.part';
511
+		$uploadPath = $exists ? $path : $path.'.part';
512 512
 
513 513
 		if ($exists) {
514 514
 			$fileId = $stat['fileid'];
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		try {
521 521
 			//upload to object storage
522 522
 			if ($size === null) {
523
-				$countStream = CountWrapper::wrap($stream, function ($writtenSize) use ($fileId, &$size) {
523
+				$countStream = CountWrapper::wrap($stream, function($writtenSize) use ($fileId, &$size) {
524 524
 					$this->getCache()->update($fileId, [
525 525
 						'size' => $writtenSize,
526 526
 					]);
@@ -546,12 +546,12 @@  discard block
 block discarded – undo
546 546
 				$this->getCache()->remove($uploadPath);
547 547
 				$this->logger->logException($ex, [
548 548
 					'app' => 'objectstore',
549
-					'message' => 'Could not create object ' . $urn . ' for ' . $path,
549
+					'message' => 'Could not create object '.$urn.' for '.$path,
550 550
 				]);
551 551
 			} else {
552 552
 				$this->logger->logException($ex, [
553 553
 					'app' => 'objectstore',
554
-					'message' => 'Could not update object ' . $urn . ' for ' . $path,
554
+					'message' => 'Could not update object '.$urn.' for '.$path,
555 555
 				]);
556 556
 			}
557 557
 			throw $ex; // make this bubble up
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 			$this->mkdir($to);
627 627
 
628 628
 			foreach ($cache->getFolderContentsById($sourceEntry->getId()) as $child) {
629
-				$this->copyInner($child, $to . '/' . $child->getName());
629
+				$this->copyInner($child, $to.'/'.$child->getName());
630 630
 			}
631 631
 		} else {
632 632
 			$this->copyFile($sourceEntry, $to);
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		$cacheEntry = $this->getCache()->get($targetPath);
682 682
 		$urn = $this->getURN($cacheEntry->getId());
683 683
 
684
-		$result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int)$chunkId, $data, $size);
684
+		$result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int) $chunkId, $data, $size);
685 685
 
686 686
 		$parts[$chunkId] = [
687 687
 			'PartNumber' => $chunkId,
@@ -709,11 +709,11 @@  discard block
 block discarded – undo
709 709
 				$stat['mimetype'] = $this->getMimeType($targetPath);
710 710
 				$this->getCache()->update($stat['fileid'], $stat);
711 711
 			}
712
-		} catch (S3MultipartUploadException|S3Exception $e) {
712
+		} catch (S3MultipartUploadException | S3Exception $e) {
713 713
 			$this->objectStore->abortMultipartUpload($urn, $writeToken);
714 714
 			$this->logger->logException($e, [
715 715
 				'app' => 'objectstore',
716
-				'message' => 'Could not compete multipart upload ' . $urn . ' with uploadId ' . $writeToken,
716
+				'message' => 'Could not compete multipart upload '.$urn.' with uploadId '.$writeToken,
717 717
 			]);
718 718
 			throw new GenericFileException('Could not write chunked file');
719 719
 		}
Please login to merge, or discard this patch.