Completed
Push — master ( f05f79...419e0a )
by
unknown
25:14 queued 14s
created
lib/private/Files/ObjectStore/ObjectStoreStorage.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 			throw new \Exception('missing IObjectStore instance');
53 53
 		}
54 54
 		if (isset($parameters['storageid'])) {
55
-			$this->id = 'object::store:' . $parameters['storageid'];
55
+			$this->id = 'object::store:'.$parameters['storageid'];
56 56
 		} else {
57
-			$this->id = 'object::store:' . $this->objectStore->getStorageId();
57
+			$this->id = 'object::store:'.$this->objectStore->getStorageId();
58 58
 		}
59 59
 		if (isset($parameters['objectPrefix'])) {
60 60
 			$this->objectPrefix = $parameters['objectPrefix'];
61 61
 		}
62 62
 		if (isset($parameters['validateWrites'])) {
63
-			$this->validateWrites = (bool)$parameters['validateWrites'];
63
+			$this->validateWrites = (bool) $parameters['validateWrites'];
64 64
 		}
65
-		$this->handleCopiesAsOwned = (bool)($parameters['handleCopiesAsOwned'] ?? false);
65
+		$this->handleCopiesAsOwned = (bool) ($parameters['handleCopiesAsOwned'] ?? false);
66 66
 
67 67
 		$this->logger = \OCP\Server::get(LoggerInterface::class);
68 68
 	}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		} catch (\Exception $ex) {
197 197
 			if ($ex->getCode() !== 404) {
198 198
 				$this->logger->error(
199
-					'Could not delete object ' . $this->getURN($entry->getId()) . ' for ' . $entry->getPath(),
199
+					'Could not delete object '.$this->getURN($entry->getId()).' for '.$entry->getPath(),
200 200
 					[
201 201
 						'app' => 'objectstore',
202 202
 						'exception' => $ex,
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		return true;
213 213
 	}
214 214
 
215
-	public function stat(string $path): array|false {
215
+	public function stat(string $path): array | false {
216 216
 		$path = $this->normalizePath($path);
217 217
 		$cacheEntry = $this->getCache()->get($path);
218 218
 		if ($cacheEntry instanceof CacheEntry) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * @return string the unified resource name used to identify the object
248 248
 	 */
249 249
 	public function getURN(int $fileId): string {
250
-		return $this->objectPrefix . $fileId;
250
+		return $this->objectPrefix.$fileId;
251 251
 	}
252 252
 
253 253
 	public function opendir(string $path) {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		}
268 268
 	}
269 269
 
270
-	public function filetype(string $path): string|false {
270
+	public function filetype(string $path): string | false {
271 271
 		$path = $this->normalizePath($path);
272 272
 		$stat = $this->stat($path);
273 273
 		if ($stat) {
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
 						$streamStat = fstat($handle);
309 309
 						$actualSize = $streamStat['size'] ?? -1;
310 310
 						if ($actualSize > -1 && $actualSize !== $filesize) {
311
-							$this->getCache()->update((int)$stat['fileid'], ['size' => $actualSize]);
311
+							$this->getCache()->update((int) $stat['fileid'], ['size' => $actualSize]);
312 312
 						}
313 313
 						return $handle;
314 314
 					} catch (NotFoundException $e) {
315 315
 						$this->logger->error(
316
-							'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
316
+							'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path,
317 317
 							[
318 318
 								'app' => 'objectstore',
319 319
 								'exception' => $e,
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 						throw $e;
323 323
 					} catch (\Exception $e) {
324 324
 						$this->logger->error(
325
-							'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
325
+							'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path,
326 326
 							[
327 327
 								'app' => 'objectstore',
328 328
 								'exception' => $e,
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 				$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
348 348
 				$handle = fopen($tmpFile, $mode);
349
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
349
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
350 350
 					$this->writeBack($tmpFile, $path);
351 351
 					unlink($tmpFile);
352 352
 				});
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 					file_put_contents($tmpFile, $source);
365 365
 				}
366 366
 				$handle = fopen($tmpFile, $mode);
367
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
367
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
368 368
 					$this->writeBack($tmpFile, $path);
369 369
 					unlink($tmpFile);
370 370
 				});
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 
375 375
 	public function file_exists(string $path): bool {
376 376
 		$path = $this->normalizePath($path);
377
-		return (bool)$this->stat($path);
377
+		return (bool) $this->stat($path);
378 378
 	}
379 379
 
380 380
 	public function rename(string $source, string $target): bool {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		return true;
387 387
 	}
388 388
 
389
-	public function getMimeType(string $path): string|false {
389
+	public function getMimeType(string $path): string | false {
390 390
 		$path = $this->normalizePath($path);
391 391
 		return parent::getMimeType($path);
392 392
 	}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 				$this->file_put_contents($path, ' ');
416 416
 			} catch (\Exception $ex) {
417 417
 				$this->logger->error(
418
-					'Could not create object for ' . $path,
418
+					'Could not create object for '.$path,
419 419
 					[
420 420
 						'app' => 'objectstore',
421 421
 						'exception' => $ex,
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 		}
465 465
 		// update stat with new data
466 466
 		$mTime = time();
467
-		$stat['size'] = (int)$size;
467
+		$stat['size'] = (int) $size;
468 468
 		$stat['mtime'] = $mTime;
469 469
 		$stat['storage_mtime'] = $mTime;
470 470
 
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 		$stat['checksum'] = '';
482 482
 
483 483
 		$exists = $this->getCache()->inCache($path);
484
-		$uploadPath = $exists ? $path : $path . '.part';
484
+		$uploadPath = $exists ? $path : $path.'.part';
485 485
 
486 486
 		if ($exists) {
487 487
 			$fileId = $stat['fileid'];
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		try {
498 498
 			//upload to object storage
499 499
 			if ($size === null) {
500
-				$countStream = CountWrapper::wrap($stream, function ($writtenSize) use ($fileId, &$size) {
500
+				$countStream = CountWrapper::wrap($stream, function($writtenSize) use ($fileId, &$size) {
501 501
 					$this->getCache()->update($fileId, [
502 502
 						'size' => $writtenSize,
503 503
 					]);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 				 */
531 531
 				$this->getCache()->remove($uploadPath);
532 532
 				$this->logger->error(
533
-					'Could not create object ' . $urn . ' for ' . $path,
533
+					'Could not create object '.$urn.' for '.$path,
534 534
 					[
535 535
 						'app' => 'objectstore',
536 536
 						'exception' => $ex,
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 				);
539 539
 			} else {
540 540
 				$this->logger->error(
541
-					'Could not update object ' . $urn . ' for ' . $path,
541
+					'Could not update object '.$urn.' for '.$path,
542 542
 					[
543 543
 						'app' => 'objectstore',
544 544
 						'exception' => $ex,
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 			$this->mkdir($to, false, ['size' => $sourceEntry->getSize()]);
703 703
 
704 704
 			foreach ($sourceCache->getFolderContentsById($sourceEntry->getId()) as $child) {
705
-				$this->copyInner($sourceCache, $child, $to . '/' . $child->getName());
705
+				$this->copyInner($sourceCache, $child, $to.'/'.$child->getName());
706 706
 			}
707 707
 		} else {
708 708
 			$this->copyFile($sourceEntry, $to);
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 		$cacheEntry = $this->getCache()->get($targetPath);
761 761
 		$urn = $this->getURN($cacheEntry->getId());
762 762
 
763
-		$result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int)$chunkId, $data, $size);
763
+		$result = $this->objectStore->uploadMultipartPart($urn, $writeToken, (int) $chunkId, $data, $size);
764 764
 
765 765
 		$parts[$chunkId] = [
766 766
 			'PartNumber' => $chunkId,
@@ -788,10 +788,10 @@  discard block
 block discarded – undo
788 788
 				$stat['mimetype'] = $this->getMimeType($targetPath);
789 789
 				$this->getCache()->update($stat['fileid'], $stat);
790 790
 			}
791
-		} catch (S3MultipartUploadException|S3Exception $e) {
791
+		} catch (S3MultipartUploadException | S3Exception $e) {
792 792
 			$this->objectStore->abortMultipartUpload($urn, $writeToken);
793 793
 			$this->logger->error(
794
-				'Could not compete multipart upload ' . $urn . ' with uploadId ' . $writeToken,
794
+				'Could not compete multipart upload '.$urn.' with uploadId '.$writeToken,
795 795
 				[
796 796
 					'app' => 'objectstore',
797 797
 					'exception' => $e,
Please login to merge, or discard this patch.