Completed
Push — master ( 86f0cb...b18372 )
by Maxence
26:28
created
apps/files_trashbin/lib/Trashbin.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		Filesystem::initMountPoints($uid);
94 94
 		if ($uid !== OC_User::getUser()) {
95 95
 			$info = Filesystem::getFileInfo($filename);
96
-			$ownerView = new View('/' . $uid . '/files');
96
+			$ownerView = new View('/'.$uid.'/files');
97 97
 			try {
98 98
 				$filename = $ownerView->getPath($info['fileid']);
99 99
 			} catch (NotFoundException $e) {
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 		$array = [];
119 119
 		foreach ($result->iterateAssociative() as $row) {
120 120
 			$array[$row['id']][$row['timestamp']] = [
121
-				'location' => (string)$row['location'],
122
-				'deletedBy' => (string)$row['deleted_by'],
121
+				'location' => (string) $row['location'],
122
+				'deletedBy' => (string) $row['deleted_by'],
123 123
 			];
124 124
 		}
125 125
 		$result->closeCursor();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	/** @param string $user */
157 157
 	private static function setUpTrash($user): void {
158
-		$view = new View('/' . $user);
158
+		$view = new View('/'.$user);
159 159
 		if (!$view->is_dir('files_trashbin')) {
160 160
 			$view->mkdir('files_trashbin');
161 161
 		}
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 
191 191
 		$view = new View('/');
192 192
 
193
-		$target = $user . '/files_trashbin/files/' . static::getTrashFilename($targetFilename, $timestamp);
194
-		$source = $owner . '/files_trashbin/files/' . static::getTrashFilename($sourceFilename, $timestamp);
193
+		$target = $user.'/files_trashbin/files/'.static::getTrashFilename($targetFilename, $timestamp);
194
+		$source = $owner.'/files_trashbin/files/'.static::getTrashFilename($sourceFilename, $timestamp);
195 195
 		$free = $view->free_space($target);
196 196
 		$isUnknownOrUnlimitedFreeSpace = $free < 0;
197 197
 		$isEnoughFreeSpaceLeft = $view->filesize($source) < $free;
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 			$ownerPath = $file_path;
237 237
 		}
238 238
 
239
-		$ownerView = new View('/' . $owner);
239
+		$ownerView = new View('/'.$owner);
240 240
 
241 241
 		// file has been deleted in between
242 242
 		if (is_null($ownerPath) || $ownerPath === '') {
243 243
 			return true;
244 244
 		}
245 245
 
246
-		$sourceInfo = $ownerView->getFileInfo('/files/' . $ownerPath);
246
+		$sourceInfo = $ownerView->getFileInfo('/files/'.$ownerPath);
247 247
 
248 248
 		if ($sourceInfo === false) {
249 249
 			return true;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		$lockingProvider = Server::get(ILockingProvider::class);
267 267
 
268 268
 		// disable proxy to prevent recursive calls
269
-		$trashPath = '/files_trashbin/files/' . static::getTrashFilename($filename, $timestamp);
269
+		$trashPath = '/files_trashbin/files/'.static::getTrashFilename($filename, $timestamp);
270 270
 		$gotLock = false;
271 271
 
272 272
 		do {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 				$timestamp = $timestamp + 1;
283 283
 
284
-				$trashPath = '/files_trashbin/files/' . static::getTrashFilename($filename, $timestamp);
284
+				$trashPath = '/files_trashbin/files/'.static::getTrashFilename($filename, $timestamp);
285 285
 			}
286 286
 		} while (!$gotLock);
287 287
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			if ($trashStorage->file_exists($trashInternalPath)) {
311 311
 				$trashStorage->unlink($trashInternalPath);
312 312
 			}
313
-			Server::get(LoggerInterface::class)->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
313
+			Server::get(LoggerInterface::class)->error('Couldn\'t move '.$file_path.' to the trash bin', ['app' => 'files_trashbin']);
314 314
 		}
315 315
 
316 316
 		if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		return $moveSuccessful;
368 368
 	}
369 369
 
370
-	private static function getConfiguredTrashbinSize(string $user): int|float {
370
+	private static function getConfiguredTrashbinSize(string $user): int | float {
371 371
 		$config = Server::get(IConfig::class);
372 372
 		$userTrashbinSize = $config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1');
373 373
 		if (is_numeric($userTrashbinSize) && ($userTrashbinSize > -1)) {
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
 			$user = OC_User::getUser();
394 394
 			$rootView = new View('/');
395 395
 
396
-			if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
396
+			if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) {
397 397
 				if ($owner !== $user) {
398
-					self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . static::getTrashFilename(basename($ownerPath), $timestamp), $rootView);
398
+					self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.static::getTrashFilename(basename($ownerPath), $timestamp), $rootView);
399 399
 				}
400
-				self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . static::getTrashFilename($filename, $timestamp));
400
+				self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.static::getTrashFilename($filename, $timestamp));
401 401
 			} elseif ($versions = Storage::getVersions($owner, $ownerPath)) {
402 402
 				foreach ($versions as $v) {
403 403
 					if ($owner !== $user) {
404
-						self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . static::getTrashFilename($v['name'] . '.v' . $v['version'], $timestamp));
404
+						self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.static::getTrashFilename($v['name'].'.v'.$v['version'], $timestamp));
405 405
 					}
406
-					self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . static::getTrashFilename($filename . '.v' . $v['version'], $timestamp));
406
+					self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.static::getTrashFilename($filename.'.v'.$v['version'], $timestamp));
407 407
 				}
408 408
 			}
409 409
 		}
@@ -468,18 +468,18 @@  discard block
 block discarded – undo
468 468
 		if (!$user) {
469 469
 			throw new \Exception('Tried to restore a file while not logged in');
470 470
 		}
471
-		$view = new View('/' . $user);
471
+		$view = new View('/'.$user);
472 472
 
473 473
 		$location = '';
474 474
 		if ($timestamp) {
475 475
 			$location = self::getLocation($user, $filename, $timestamp);
476 476
 			if ($location === false) {
477
-				Server::get(LoggerInterface::class)->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
477
+				Server::get(LoggerInterface::class)->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']);
478 478
 			} else {
479 479
 				// if location no longer exists, restore file in the root directory
480 480
 				if ($location !== '/'
481
-					&& (!$view->is_dir('files/' . $location)
482
-						|| !$view->isCreatable('files/' . $location))
481
+					&& (!$view->is_dir('files/'.$location)
482
+						|| !$view->isCreatable('files/'.$location))
483 483
 				) {
484 484
 					$location = '';
485 485
 				}
@@ -489,8 +489,8 @@  discard block
 block discarded – undo
489 489
 		// we need a  extension in case a file/dir with the same name already exists
490 490
 		$uniqueFilename = self::getUniqueFilename($location, $filename, $view);
491 491
 
492
-		$source = Filesystem::normalizePath('files_trashbin/files/' . $file);
493
-		$target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename);
492
+		$source = Filesystem::normalizePath('files_trashbin/files/'.$file);
493
+		$target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename);
494 494
 		if (!$view->file_exists($source)) {
495 495
 			return false;
496 496
 		}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 		}
503 503
 
504 504
 		$sourcePath = Filesystem::normalizePath($file);
505
-		$targetPath = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename);
505
+		$targetPath = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename);
506 506
 
507 507
 		$sourceNode = self::getNodeForPath($user, $sourcePath);
508 508
 		$targetNode = self::getNodeForPath($user, $targetPath, 'files');
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 		// handle the restore result
521 521
 		if ($restoreResult) {
522 522
 			$fakeRoot = $view->getRoot();
523
-			$view->chroot('/' . $user . '/files');
524
-			$view->touch('/' . $location . '/' . $uniqueFilename, $mtime);
523
+			$view->chroot('/'.$user.'/files');
524
+			$view->touch('/'.$location.'/'.$uniqueFilename, $mtime);
525 525
 			$view->chroot($fakeRoot);
526 526
 			Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => $targetPath, 'trashPath' => $sourcePath]);
527 527
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 			$user = OC_User::getUser();
565 565
 			$rootView = new View('/');
566 566
 
567
-			$target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename);
567
+			$target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename);
568 568
 
569 569
 			[$owner, $ownerPath] = self::getUidAndFilename($target);
570 570
 
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
 				$versionedFile = $file;
580 580
 			}
581 581
 
582
-			if ($view->is_dir('/files_trashbin/versions/' . $file)) {
583
-				$rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath));
582
+			if ($view->is_dir('/files_trashbin/versions/'.$file)) {
583
+				$rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath));
584 584
 			} elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) {
585 585
 				foreach ($versions as $v) {
586 586
 					if ($timestamp) {
587
-						$rootView->rename($user . '/files_trashbin/versions/' . static::getTrashFilename($versionedFile . '.v' . $v, $timestamp), $owner . '/files_versions/' . $ownerPath . '.v' . $v);
587
+						$rootView->rename($user.'/files_trashbin/versions/'.static::getTrashFilename($versionedFile.'.v'.$v, $timestamp), $owner.'/files_versions/'.$ownerPath.'.v'.$v);
588 588
 					} else {
589
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
589
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
590 590
 					}
591 591
 				}
592 592
 			}
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	public static function deleteAll() {
600 600
 		$user = OC_User::getUser();
601 601
 		$userRoot = \OC::$server->getUserFolder($user)->getParent();
602
-		$view = new View('/' . $user);
602
+		$view = new View('/'.$user);
603 603
 		$fileInfos = $view->getDirectoryContent('files_trashbin/files');
604 604
 
605 605
 		try {
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 */
675 675
 	public static function delete($filename, $user, $timestamp = null) {
676 676
 		$userRoot = \OC::$server->getUserFolder($user)->getParent();
677
-		$view = new View('/' . $user);
677
+		$view = new View('/'.$user);
678 678
 		$size = 0;
679 679
 
680 680
 		if ($timestamp) {
@@ -693,20 +693,20 @@  discard block
 block discarded – undo
693 693
 		$size += self::deleteVersions($view, $file, $filename, $timestamp, $user);
694 694
 
695 695
 		try {
696
-			$node = $userRoot->get('/files_trashbin/files/' . $file);
696
+			$node = $userRoot->get('/files_trashbin/files/'.$file);
697 697
 		} catch (NotFoundException $e) {
698 698
 			return $size;
699 699
 		}
700 700
 
701 701
 		if ($node instanceof Folder) {
702
-			$size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file));
702
+			$size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file));
703 703
 		} elseif ($node instanceof File) {
704
-			$size += $view->filesize('/files_trashbin/files/' . $file);
704
+			$size += $view->filesize('/files_trashbin/files/'.$file);
705 705
 		}
706 706
 
707
-		self::emitTrashbinPreDelete('/files_trashbin/files/' . $file);
707
+		self::emitTrashbinPreDelete('/files_trashbin/files/'.$file);
708 708
 		$node->delete();
709
-		self::emitTrashbinPostDelete('/files_trashbin/files/' . $file);
709
+		self::emitTrashbinPostDelete('/files_trashbin/files/'.$file);
710 710
 
711 711
 		return $size;
712 712
 	}
@@ -716,20 +716,20 @@  discard block
 block discarded – undo
716 716
 	 * @param string $filename
717 717
 	 * @param ?int $timestamp
718 718
 	 */
719
-	private static function deleteVersions(View $view, $file, $filename, $timestamp, string $user): int|float {
719
+	private static function deleteVersions(View $view, $file, $filename, $timestamp, string $user): int | float {
720 720
 		$size = 0;
721 721
 		if (Server::get(IAppManager::class)->isEnabledForUser('files_versions')) {
722
-			if ($view->is_dir('files_trashbin/versions/' . $file)) {
723
-				$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
724
-				$view->unlink('files_trashbin/versions/' . $file);
722
+			if ($view->is_dir('files_trashbin/versions/'.$file)) {
723
+				$size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file));
724
+				$view->unlink('files_trashbin/versions/'.$file);
725 725
 			} elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) {
726 726
 				foreach ($versions as $v) {
727 727
 					if ($timestamp) {
728
-						$size += $view->filesize('/files_trashbin/versions/' . static::getTrashFilename($filename . '.v' . $v, $timestamp));
729
-						$view->unlink('/files_trashbin/versions/' . static::getTrashFilename($filename . '.v' . $v, $timestamp));
728
+						$size += $view->filesize('/files_trashbin/versions/'.static::getTrashFilename($filename.'.v'.$v, $timestamp));
729
+						$view->unlink('/files_trashbin/versions/'.static::getTrashFilename($filename.'.v'.$v, $timestamp));
730 730
 					} else {
731
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v);
732
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v);
731
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v);
732
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v);
733 733
 					}
734 734
 				}
735 735
 			}
@@ -746,13 +746,13 @@  discard block
 block discarded – undo
746 746
 	 */
747 747
 	public static function file_exists($filename, $timestamp = null) {
748 748
 		$user = OC_User::getUser();
749
-		$view = new View('/' . $user);
749
+		$view = new View('/'.$user);
750 750
 
751 751
 		if ($timestamp) {
752 752
 			$filename = static::getTrashFilename($filename, $timestamp);
753 753
 		}
754 754
 
755
-		$target = Filesystem::normalizePath('files_trashbin/files/' . $filename);
755
+		$target = Filesystem::normalizePath('files_trashbin/files/'.$filename);
756 756
 		return $view->file_exists($target);
757 757
 	}
758 758
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 		$query = Server::get(IDBConnection::class)->getQueryBuilder();
767 767
 		$query->delete('files_trash')
768 768
 			->where($query->expr()->eq('user', $query->createNamedParameter($uid)));
769
-		return (bool)$query->executeStatement();
769
+		return (bool) $query->executeStatement();
770 770
 	}
771 771
 
772 772
 	/**
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 * @param string $user
777 777
 	 * @return int|float available free space for trash bin
778 778
 	 */
779
-	private static function calculateFreeSpace(int|float $trashbinSize, string $user): int|float {
779
+	private static function calculateFreeSpace(int | float $trashbinSize, string $user): int | float {
780 780
 		$configuredTrashbinSize = static::getConfiguredTrashbinSize($user);
781 781
 		if ($configuredTrashbinSize > -1) {
782 782
 			return $configuredTrashbinSize - $trashbinSize;
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 	 * @param int|float $availableSpace available disc space
879 879
 	 * @return int|float size of deleted files
880 880
 	 */
881
-	protected static function deleteFiles(array $files, string $user, int|float $availableSpace): int|float {
881
+	protected static function deleteFiles(array $files, string $user, int | float $availableSpace): int | float {
882 882
 		$expiration = Server::get(Expiration::class);
883 883
 		$size = 0;
884 884
 
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 				if ($availableSpace <= 0 && $expiration->isExpired($file['mtime'], true)) {
888 888
 					$tmp = self::delete($file['name'], $user, $file['mtime']);
889 889
 					Server::get(LoggerInterface::class)->info(
890
-						'remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota) for user "{user}"',
890
+						'remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota) for user "{user}"',
891 891
 						[
892 892
 							'app' => 'files_trashbin',
893 893
 							'user' => $user,
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 					$size += self::delete($filename, $user, $timestamp);
923 923
 					$count++;
924 924
 				} catch (NotPermittedException $e) {
925
-					Server::get(LoggerInterface::class)->warning('Removing "' . $filename . '" from trashbin failed for user "{user}"',
925
+					Server::get(LoggerInterface::class)->warning('Removing "'.$filename.'" from trashbin failed for user "{user}"',
926 926
 						[
927 927
 							'exception' => $e,
928 928
 							'app' => 'files_trashbin',
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 					);
932 932
 				}
933 933
 				Server::get(LoggerInterface::class)->info(
934
-					'Remove "' . $filename . '" from trashbin for user "{user}" because it exceeds max retention obligation term.',
934
+					'Remove "'.$filename.'" from trashbin for user "{user}" because it exceeds max retention obligation term.',
935 935
 					[
936 936
 						'app' => 'files_trashbin',
937 937
 						'user' => $user,
@@ -954,22 +954,22 @@  discard block
 block discarded – undo
954 954
 	 * @return int|float
955 955
 	 * @throws Exceptions\CopyRecursiveException
956 956
 	 */
957
-	private static function copy_recursive($source, $destination, View $view): int|float {
957
+	private static function copy_recursive($source, $destination, View $view): int | float {
958 958
 		$size = 0;
959 959
 		if ($view->is_dir($source)) {
960 960
 			$view->mkdir($destination);
961 961
 			$view->touch($destination, $view->filemtime($source));
962 962
 			foreach ($view->getDirectoryContent($source) as $i) {
963
-				$pathDir = $source . '/' . $i['name'];
963
+				$pathDir = $source.'/'.$i['name'];
964 964
 				if ($view->is_dir($pathDir)) {
965
-					$size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view);
965
+					$size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view);
966 966
 				} else {
967 967
 					$size += $view->filesize($pathDir);
968
-					$result = $view->copy($pathDir, $destination . '/' . $i['name']);
968
+					$result = $view->copy($pathDir, $destination.'/'.$i['name']);
969 969
 					if (!$result) {
970 970
 						throw new CopyRecursiveException();
971 971
 					}
972
-					$view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir));
972
+					$view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir));
973 973
 				}
974 974
 			}
975 975
 		} else {
@@ -990,17 +990,17 @@  discard block
 block discarded – undo
990 990
 	 * @param int $timestamp timestamp when the file was deleted
991 991
 	 */
992 992
 	private static function getVersionsFromTrash($filename, $timestamp, string $user): array {
993
-		$view = new View('/' . $user . '/files_trashbin/versions');
993
+		$view = new View('/'.$user.'/files_trashbin/versions');
994 994
 		$versions = [];
995 995
 
996 996
 		/** @var \OC\Files\Storage\Storage $storage */
997
-		[$storage,] = $view->resolvePath('/');
997
+		[$storage, ] = $view->resolvePath('/');
998 998
 
999 999
 		$pattern = Server::get(IDBConnection::class)->escapeLikeParameter(basename($filename));
1000 1000
 		if ($timestamp) {
1001 1001
 			// fetch for old versions
1002
-			$escapedTimestamp = Server::get(IDBConnection::class)->escapeLikeParameter((string)$timestamp);
1003
-			$pattern .= '.v%.d' . $escapedTimestamp;
1002
+			$escapedTimestamp = Server::get(IDBConnection::class)->escapeLikeParameter((string) $timestamp);
1003
+			$pattern .= '.v%.d'.$escapedTimestamp;
1004 1004
 			$offset = -strlen($escapedTimestamp) - 2;
1005 1005
 		} else {
1006 1006
 			$pattern .= '.v%';
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 			Server::get(IDBConnection::class)->getQueryBuilder(),
1013 1013
 			Server::get(IFilesMetadataManager::class),
1014 1014
 		);
1015
-		$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/' . $filename)), '/');
1015
+		$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'.$filename)), '/');
1016 1016
 		$parentId = $cache->getId($normalizedParentPath);
1017 1017
 		if ($parentId === -1) {
1018 1018
 			return [];
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 		$result->closeCursor();
1029 1029
 
1030 1030
 		/** @var CacheEntry[] $matches */
1031
-		$matches = array_map(function (array $data) {
1031
+		$matches = array_map(function(array $data) {
1032 1032
 			return Cache::cacheEntryFromData($data, Server::get(IMimeTypeLoader::class));
1033 1033
 		}, $entries);
1034 1034
 
@@ -1058,18 +1058,18 @@  discard block
 block discarded – undo
1058 1058
 		$name = pathinfo($filename, PATHINFO_FILENAME);
1059 1059
 		$l = Util::getL10N('files_trashbin');
1060 1060
 
1061
-		$location = '/' . trim($location, '/');
1061
+		$location = '/'.trim($location, '/');
1062 1062
 
1063 1063
 		// if extension is not empty we set a dot in front of it
1064 1064
 		if ($ext !== '') {
1065
-			$ext = '.' . $ext;
1065
+			$ext = '.'.$ext;
1066 1066
 		}
1067 1067
 
1068
-		if ($view->file_exists('files' . $location . '/' . $filename)) {
1068
+		if ($view->file_exists('files'.$location.'/'.$filename)) {
1069 1069
 			$i = 2;
1070
-			$uniqueName = $name . ' (' . $l->t('restored') . ')' . $ext;
1071
-			while ($view->file_exists('files' . $location . '/' . $uniqueName)) {
1072
-				$uniqueName = $name . ' (' . $l->t('restored') . ' ' . $i . ')' . $ext;
1070
+			$uniqueName = $name.' ('.$l->t('restored').')'.$ext;
1071
+			while ($view->file_exists('files'.$location.'/'.$uniqueName)) {
1072
+				$uniqueName = $name.' ('.$l->t('restored').' '.$i.')'.$ext;
1073 1073
 				$i++;
1074 1074
 			}
1075 1075
 
@@ -1085,8 +1085,8 @@  discard block
 block discarded – undo
1085 1085
 	 * @param View $view file view on the root folder
1086 1086
 	 * @return int|float size of the folder
1087 1087
 	 */
1088
-	private static function calculateSize(View $view): int|float {
1089
-		$root = Server::get(IConfig::class)->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath('');
1088
+	private static function calculateSize(View $view): int | float {
1089
+		$root = Server::get(IConfig::class)->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath('');
1090 1090
 		if (!file_exists($root)) {
1091 1091
 			return 0;
1092 1092
 		}
@@ -1116,8 +1116,8 @@  discard block
 block discarded – undo
1116 1116
 	 * @param string $user user who owns the trash bin
1117 1117
 	 * @return int|float trash bin size
1118 1118
 	 */
1119
-	private static function getTrashbinSize(string $user): int|float {
1120
-		$view = new View('/' . $user);
1119
+	private static function getTrashbinSize(string $user): int | float {
1120
+		$view = new View('/'.$user);
1121 1121
 		$fileInfo = $view->getFileInfo('/files_trashbin');
1122 1122
 		return isset($fileInfo['size']) ? $fileInfo['size'] : 0;
1123 1123
 	}
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 	 * @return bool
1130 1130
 	 */
1131 1131
 	public static function isEmpty($user) {
1132
-		$view = new View('/' . $user . '/files_trashbin');
1132
+		$view = new View('/'.$user.'/files_trashbin');
1133 1133
 		if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
1134 1134
 			while (($file = readdir($dh)) !== false) {
1135 1135
 				if (!Filesystem::isIgnoredDir($file)) {
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 	 * Return the filename used in the trash bin
1153 1153
 	 */
1154 1154
 	public static function getTrashFilename(string $filename, int $timestamp): string {
1155
-		$trashFilename = $filename . '.d' . $timestamp;
1155
+		$trashFilename = $filename.'.d'.$timestamp;
1156 1156
 		$length = strlen($trashFilename);
1157 1157
 		// oc_filecache `name` column has a limit of 250 chars
1158 1158
 		$maxLength = 250;
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 		}
1181 1181
 
1182 1182
 		$view = Server::get(View::class);
1183
-		$fullPath = '/' . $user . '/' . $baseDir . '/' . $path;
1183
+		$fullPath = '/'.$user.'/'.$baseDir.'/'.$path;
1184 1184
 
1185 1185
 		if (Filesystem::is_dir($path)) {
1186 1186
 			return new NonExistingFolder($rootFolder, $view, $fullPath);
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 			$share = $federatedShareProvider->getShareByToken($token);
1207 1207
 
1208 1208
 			return $share->getSharedWith();
1209
-		} catch (NotFoundExceptionInterface|ContainerExceptionInterface|ShareNotFound) {
1209
+		} catch (NotFoundExceptionInterface | ContainerExceptionInterface | ShareNotFound) {
1210 1210
 		}
1211 1211
 
1212 1212
 		return $user;
Please login to merge, or discard this patch.