Passed
Push — master ( 9979b6...02fa6a )
by Morris
17:32 queued 10s
created
apps/files_trashbin/lib/Trashbin.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		Filesystem::initMountPoints($uid);
112 112
 		if ($uid !== User::getUser()) {
113 113
 			$info = Filesystem::getFileInfo($filename);
114
-			$ownerView = new View('/' . $uid . '/files');
114
+			$ownerView = new View('/'.$uid.'/files');
115 115
 			try {
116 116
 				$filename = $ownerView->getPath($info['fileid']);
117 117
 			} catch (NotFoundException $e) {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	private static function setUpTrash($user) {
165
-		$view = new View('/' . $user);
165
+		$view = new View('/'.$user);
166 166
 		if (!$view->is_dir('files_trashbin')) {
167 167
 			$view->mkdir('files_trashbin');
168 168
 		}
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$view = new View('/');
199 199
 
200
-		$target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp;
201
-		$source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp;
200
+		$target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp;
201
+		$source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp;
202 202
 		$free = $view->free_space($target);
203 203
 		$isUnknownOrUnlimitedFreeSpace = $free < 0;
204 204
 		$isEnoughFreeSpaceLeft = $view->filesize($source) < $free;
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
 			$ownerPath = $file_path;
238 238
 		}
239 239
 
240
-		$ownerView = new View('/' . $owner);
240
+		$ownerView = new View('/'.$owner);
241 241
 		// file has been deleted in between
242
-		if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) {
242
+		if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) {
243 243
 			return true;
244 244
 		}
245 245
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		$lockingProvider = \OC::$server->getLockingProvider();
261 261
 
262 262
 		// disable proxy to prevent recursive calls
263
-		$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
263
+		$trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp;
264 264
 		$gotLock = false;
265 265
 
266 266
 		while (!$gotLock) {
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
 
277 277
 				$timestamp = $timestamp + 1;
278 278
 
279
-				$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
279
+				$trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp;
280 280
 			}
281 281
 		}
282 282
 
283 283
 		/** @var \OC\Files\Storage\Storage $sourceStorage */
284
-		[$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/' . $ownerPath);
284
+		[$sourceStorage, $sourceInternalPath] = $ownerView->resolvePath('/files/'.$ownerPath);
285 285
 
286 286
 
287 287
 		if ($trashStorage->file_exists($trashInternalPath)) {
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 		}
290 290
 
291 291
 		$config = \OC::$server->getConfig();
292
-		$systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1');
293
-		$userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1');
292
+		$systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1');
293
+		$userTrashbinSize = (int) $config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1');
294 294
 		$configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize;
295 295
 		if ($configuredTrashbinSize >= 0 && $sourceStorage->filesize($sourceInternalPath) >= $configuredTrashbinSize) {
296 296
 			return false;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			if ($trashStorage->file_exists($trashInternalPath)) {
311 311
 				$trashStorage->unlink($trashInternalPath);
312 312
 			}
313
-			\OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
313
+			\OC::$server->getLogger()->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
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 				\OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
337 337
 			}
338 338
 			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path),
339
-				'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]);
339
+				'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)]);
340 340
 
341 341
 			self::retainVersions($filename, $owner, $ownerPath, $timestamp);
342 342
 
@@ -371,17 +371,17 @@  discard block
 block discarded – undo
371 371
 			$user = User::getUser();
372 372
 			$rootView = new View('/');
373 373
 
374
-			if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
374
+			if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) {
375 375
 				if ($owner !== $user) {
376
-					self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView);
376
+					self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView);
377 377
 				}
378
-				self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp);
378
+				self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp);
379 379
 			} elseif ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
380 380
 				foreach ($versions as $v) {
381 381
 					if ($owner !== $user) {
382
-						self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp);
382
+						self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp);
383 383
 					}
384
-					self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp);
384
+					self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp);
385 385
 				}
386 386
 			}
387 387
 		}
@@ -443,18 +443,18 @@  discard block
 block discarded – undo
443 443
 	 */
444 444
 	public static function restore($file, $filename, $timestamp) {
445 445
 		$user = User::getUser();
446
-		$view = new View('/' . $user);
446
+		$view = new View('/'.$user);
447 447
 
448 448
 		$location = '';
449 449
 		if ($timestamp) {
450 450
 			$location = self::getLocation($user, $filename, $timestamp);
451 451
 			if ($location === false) {
452
-				\OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
452
+				\OC::$server->getLogger()->error('trash bin database inconsistent! ($user: '.$user.' $filename: '.$filename.', $timestamp: '.$timestamp.')', ['app' => 'files_trashbin']);
453 453
 			} else {
454 454
 				// if location no longer exists, restore file in the root directory
455 455
 				if ($location !== '/' &&
456
-					(!$view->is_dir('files/' . $location) ||
457
-						!$view->isCreatable('files/' . $location))
456
+					(!$view->is_dir('files/'.$location) ||
457
+						!$view->isCreatable('files/'.$location))
458 458
 				) {
459 459
 					$location = '';
460 460
 				}
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 		// we need a  extension in case a file/dir with the same name already exists
465 465
 		$uniqueFilename = self::getUniqueFilename($location, $filename, $view);
466 466
 
467
-		$source = Filesystem::normalizePath('files_trashbin/files/' . $file);
468
-		$target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename);
467
+		$source = Filesystem::normalizePath('files_trashbin/files/'.$file);
468
+		$target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename);
469 469
 		if (!$view->file_exists($source)) {
470 470
 			return false;
471 471
 		}
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 		// handle the restore result
481 481
 		if ($restoreResult) {
482 482
 			$fakeRoot = $view->getRoot();
483
-			$view->chroot('/' . $user . '/files');
484
-			$view->touch('/' . $location . '/' . $uniqueFilename, $mtime);
483
+			$view->chroot('/'.$user.'/files');
484
+			$view->touch('/'.$location.'/'.$uniqueFilename, $mtime);
485 485
 			$view->chroot($fakeRoot);
486
-			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename),
486
+			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', ['filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename),
487 487
 				'trashPath' => Filesystem::normalizePath($file)]);
488 488
 
489 489
 			self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp);
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 			$user = User::getUser();
516 516
 			$rootView = new View('/');
517 517
 
518
-			$target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename);
518
+			$target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename);
519 519
 
520 520
 			[$owner, $ownerPath] = self::getUidAndFilename($target);
521 521
 
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
 				$versionedFile = $file;
531 531
 			}
532 532
 
533
-			if ($view->is_dir('/files_trashbin/versions/' . $file)) {
534
-				$rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath));
533
+			if ($view->is_dir('/files_trashbin/versions/'.$file)) {
534
+				$rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath));
535 535
 			} elseif ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) {
536 536
 				foreach ($versions as $v) {
537 537
 					if ($timestamp) {
538
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
538
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
539 539
 					} else {
540
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
540
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
541 541
 					}
542 542
 				}
543 543
 			}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	public static function deleteAll() {
551 551
 		$user = User::getUser();
552 552
 		$userRoot = \OC::$server->getUserFolder($user)->getParent();
553
-		$view = new View('/' . $user);
553
+		$view = new View('/'.$user);
554 554
 		$fileInfos = $view->getDirectoryContent('files_trashbin/files');
555 555
 
556 556
 		try {
@@ -622,13 +622,13 @@  discard block
 block discarded – undo
622 622
 	 */
623 623
 	public static function delete($filename, $user, $timestamp = null) {
624 624
 		$userRoot = \OC::$server->getUserFolder($user)->getParent();
625
-		$view = new View('/' . $user);
625
+		$view = new View('/'.$user);
626 626
 		$size = 0;
627 627
 
628 628
 		if ($timestamp) {
629 629
 			$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?');
630 630
 			$query->execute([$user, $filename, $timestamp]);
631
-			$file = $filename . '.d' . $timestamp;
631
+			$file = $filename.'.d'.$timestamp;
632 632
 		} else {
633 633
 			$file = $filename;
634 634
 		}
@@ -636,20 +636,20 @@  discard block
 block discarded – undo
636 636
 		$size += self::deleteVersions($view, $file, $filename, $timestamp, $user);
637 637
 
638 638
 		try {
639
-			$node = $userRoot->get('/files_trashbin/files/' . $file);
639
+			$node = $userRoot->get('/files_trashbin/files/'.$file);
640 640
 		} catch (NotFoundException $e) {
641 641
 			return $size;
642 642
 		}
643 643
 
644 644
 		if ($node instanceof Folder) {
645
-			$size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file));
645
+			$size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file));
646 646
 		} elseif ($node instanceof File) {
647
-			$size += $view->filesize('/files_trashbin/files/' . $file);
647
+			$size += $view->filesize('/files_trashbin/files/'.$file);
648 648
 		}
649 649
 
650
-		self::emitTrashbinPreDelete('/files_trashbin/files/' . $file);
650
+		self::emitTrashbinPreDelete('/files_trashbin/files/'.$file);
651 651
 		$node->delete();
652
-		self::emitTrashbinPostDelete('/files_trashbin/files/' . $file);
652
+		self::emitTrashbinPostDelete('/files_trashbin/files/'.$file);
653 653
 
654 654
 		return $size;
655 655
 	}
@@ -665,17 +665,17 @@  discard block
 block discarded – undo
665 665
 	private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) {
666 666
 		$size = 0;
667 667
 		if (\OCP\App::isEnabled('files_versions')) {
668
-			if ($view->is_dir('files_trashbin/versions/' . $file)) {
669
-				$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
670
-				$view->unlink('files_trashbin/versions/' . $file);
668
+			if ($view->is_dir('files_trashbin/versions/'.$file)) {
669
+				$size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file));
670
+				$view->unlink('files_trashbin/versions/'.$file);
671 671
 			} elseif ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) {
672 672
 				foreach ($versions as $v) {
673 673
 					if ($timestamp) {
674
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp);
675
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp);
674
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
675
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
676 676
 					} else {
677
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v);
678
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v);
677
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v);
678
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v);
679 679
 					}
680 680
 				}
681 681
 			}
@@ -692,13 +692,13 @@  discard block
 block discarded – undo
692 692
 	 */
693 693
 	public static function file_exists($filename, $timestamp = null) {
694 694
 		$user = User::getUser();
695
-		$view = new View('/' . $user);
695
+		$view = new View('/'.$user);
696 696
 
697 697
 		if ($timestamp) {
698
-			$filename = $filename . '.d' . $timestamp;
698
+			$filename = $filename.'.d'.$timestamp;
699 699
 		}
700 700
 
701
-		$target = Filesystem::normalizePath('files_trashbin/files/' . $filename);
701
+		$target = Filesystem::normalizePath('files_trashbin/files/'.$filename);
702 702
 		return $view->file_exists($target);
703 703
 	}
704 704
 
@@ -722,11 +722,11 @@  discard block
 block discarded – undo
722 722
 	 */
723 723
 	private static function calculateFreeSpace($trashbinSize, $user) {
724 724
 		$config = \OC::$server->getConfig();
725
-		$userTrashbinSize = (int)$config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1');
725
+		$userTrashbinSize = (int) $config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1');
726 726
 		if ($userTrashbinSize > -1) {
727 727
 			return $userTrashbinSize - $trashbinSize;
728 728
 		}
729
-		$systemTrashbinSize = (int)$config->getAppValue('files_trashbin', 'trashbin_size', '-1');
729
+		$systemTrashbinSize = (int) $config->getAppValue('files_trashbin', 'trashbin_size', '-1');
730 730
 		if ($systemTrashbinSize > -1) {
731 731
 			return $systemTrashbinSize - $trashbinSize;
732 732
 		}
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 			foreach ($files as $file) {
836 836
 				if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
837 837
 					$tmp = self::delete($file['name'], $user, $file['mtime']);
838
-					\OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
838
+					\OC::$server->getLogger()->info('remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
839 839
 					$availableSpace += $tmp;
840 840
 					$size += $tmp;
841 841
 				} else {
@@ -866,10 +866,10 @@  discard block
 block discarded – undo
866 866
 					$size += self::delete($filename, $user, $timestamp);
867 867
 					$count++;
868 868
 				} catch (\OCP\Files\NotPermittedException $e) {
869
-					\OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']);
869
+					\OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "'.$filename.'" from trashbin failed.']);
870 870
 				}
871 871
 				\OC::$server->getLogger()->info(
872
-					'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
872
+					'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.',
873 873
 					['app' => 'files_trashbin']
874 874
 				);
875 875
 			} else {
@@ -895,16 +895,16 @@  discard block
 block discarded – undo
895 895
 			$view->mkdir($destination);
896 896
 			$view->touch($destination, $view->filemtime($source));
897 897
 			foreach ($view->getDirectoryContent($source) as $i) {
898
-				$pathDir = $source . '/' . $i['name'];
898
+				$pathDir = $source.'/'.$i['name'];
899 899
 				if ($view->is_dir($pathDir)) {
900
-					$size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view);
900
+					$size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view);
901 901
 				} else {
902 902
 					$size += $view->filesize($pathDir);
903
-					$result = $view->copy($pathDir, $destination . '/' . $i['name']);
903
+					$result = $view->copy($pathDir, $destination.'/'.$i['name']);
904 904
 					if (!$result) {
905 905
 						throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException();
906 906
 					}
907
-					$view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir));
907
+					$view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir));
908 908
 				}
909 909
 			}
910 910
 		} else {
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
 	 * @return array
927 927
 	 */
928 928
 	private static function getVersionsFromTrash($filename, $timestamp, $user) {
929
-		$view = new View('/' . $user . '/files_trashbin/versions');
929
+		$view = new View('/'.$user.'/files_trashbin/versions');
930 930
 		$versions = [];
931 931
 
932 932
 		/** @var \OC\Files\Storage\Storage $storage */
933
-		[$storage,] = $view->resolvePath('/');
933
+		[$storage, ] = $view->resolvePath('/');
934 934
 
935 935
 		//force rescan of versions, local storage may not have updated the cache
936 936
 		if (!self::$scannedVersions) {
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 		if ($timestamp) {
943 943
 			// fetch for old versions
944 944
 			$escapedTimestamp = \OC::$server->getDatabaseConnection()->escapeLikeParameter($timestamp);
945
-			$pattern .= '.v%.d' . $escapedTimestamp;
945
+			$pattern .= '.v%.d'.$escapedTimestamp;
946 946
 			$offset = -strlen($escapedTimestamp) - 2;
947 947
 		} else {
948 948
 			$pattern .= '.v%';
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			\OC::$server->getLogger(),
957 957
 			$cache
958 958
 		);
959
-		$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/');
959
+		$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'.$filename)), '/');
960 960
 		$parentId = $cache->getId($normalizedParentPath);
961 961
 		if ($parentId === -1) {
962 962
 			return [];
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 			->andWhere($query->expr()->iLike('name', $query->createNamedParameter($pattern)));
969 969
 
970 970
 		/** @var CacheEntry[] $matches */
971
-		$matches = array_map(function (array $data) {
971
+		$matches = array_map(function(array $data) {
972 972
 			return Cache::cacheEntryFromData($data, \OC::$server->getMimeTypeLoader());
973 973
 		}, $query->execute()->fetchAll());
974 974
 
@@ -998,18 +998,18 @@  discard block
 block discarded – undo
998 998
 		$name = pathinfo($filename, PATHINFO_FILENAME);
999 999
 		$l = \OC::$server->getL10N('files_trashbin');
1000 1000
 
1001
-		$location = '/' . trim($location, '/');
1001
+		$location = '/'.trim($location, '/');
1002 1002
 
1003 1003
 		// if extension is not empty we set a dot in front of it
1004 1004
 		if ($ext !== '') {
1005
-			$ext = '.' . $ext;
1005
+			$ext = '.'.$ext;
1006 1006
 		}
1007 1007
 
1008
-		if ($view->file_exists('files' . $location . '/' . $filename)) {
1008
+		if ($view->file_exists('files'.$location.'/'.$filename)) {
1009 1009
 			$i = 2;
1010
-			$uniqueName = $name . " (" . $l->t("restored") . ")" . $ext;
1011
-			while ($view->file_exists('files' . $location . '/' . $uniqueName)) {
1012
-				$uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext;
1010
+			$uniqueName = $name." (".$l->t("restored").")".$ext;
1011
+			while ($view->file_exists('files'.$location.'/'.$uniqueName)) {
1012
+				$uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext;
1013 1013
 				$i++;
1014 1014
 			}
1015 1015
 
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 	 * @return integer size of the folder
1027 1027
 	 */
1028 1028
 	private static function calculateSize($view) {
1029
-		$root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath('');
1029
+		$root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath('');
1030 1030
 		if (!file_exists($root)) {
1031 1031
 			return 0;
1032 1032
 		}
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 	 * @return integer trash bin size
1058 1058
 	 */
1059 1059
 	private static function getTrashbinSize($user) {
1060
-		$view = new View('/' . $user);
1060
+		$view = new View('/'.$user);
1061 1061
 		$fileInfo = $view->getFileInfo('/files_trashbin');
1062 1062
 		return isset($fileInfo['size']) ? $fileInfo['size'] : 0;
1063 1063
 	}
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 	 * @return bool
1070 1070
 	 */
1071 1071
 	public static function isEmpty($user) {
1072
-		$view = new View('/' . $user . '/files_trashbin');
1072
+		$view = new View('/'.$user.'/files_trashbin');
1073 1073
 		if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
1074 1074
 			while ($file = readdir($dh)) {
1075 1075
 				if (!Filesystem::isIgnoredDir($file)) {
Please login to merge, or discard this patch.