Completed
Pull Request — master (#5174)
by Björn
16:36
created
apps/comments/appinfo/app.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 		$application = new \OCP\AppFramework\App('comments');
51 51
 		return $application->getContainer()->query(\OCA\Comments\Notification\Notifier::class);
52 52
 	},
53
-	function () {
53
+	function() {
54 54
 		$l = \OC::$server->getL10N('comments');
55 55
 		return ['id' => 'comments', 'name' => $l->t('Comments')];
56 56
 	}
57 57
 );
58 58
 
59 59
 $commentsManager = \OC::$server->getCommentsManager();
60
-$commentsManager->registerEventHandler(function () {
60
+$commentsManager->registerEventHandler(function() {
61 61
 	$application = new \OCP\AppFramework\App('comments');
62 62
 	/** @var \OCA\Comments\EventHandler $handler */
63 63
 	$handler = $application->getContainer()->query(\OCA\Comments\EventHandler::class);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 $commentsManager->registerDisplayNameResolver('user', function($id) {
67 67
 	$manager = \OC::$server->getUserManager();
68 68
 	$user = $manager->get($id);
69
-	if(is_null($user)) {
69
+	if (is_null($user)) {
70 70
 		$l = \OC::$server->getL10N('comments');
71 71
 		$displayName = $l->t('Unknown user');
72 72
 	} else {
Please login to merge, or discard this patch.
apps/files_trashbin/templates/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 					<label for="select_all_trash">
28 28
 						<span class="hidden-visually"><?php p($l->t('Select all'))?></span>
29 29
 					</label>
30
-					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a>
30
+					<a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a>
31 31
 					<span id="selectedActionsList" class='selectedActions'>
32 32
 						<a href="" class="undelete">
33 33
 							<span class="icon icon-history"></span>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 				</div>
38 38
 			</th>
39 39
 			<th id="headerDate" class="hidden column-mtime">
40
-				<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Deleted' )); ?></span><span class="sort-indicator"></span></a>
40
+				<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Deleted')); ?></span><span class="sort-indicator"></span></a>
41 41
 				<span class="selectedActions">
42 42
 					<a href="" class="delete-selected">
43 43
 						<span><?php p($l->t('Delete'))?></span>
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/undelete.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 
32 32
 $dir = '/';
33 33
 if (isset($_POST['dir'])) {
34
-	$dir = rtrim((string)$_POST['dir'], '/'). '/';
34
+	$dir = rtrim((string) $_POST['dir'], '/').'/';
35 35
 }
36 36
 $allFiles = false;
37
-if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true') {
37
+if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') {
38 38
 	$allFiles = true;
39 39
 	$list = array();
40 40
 	$dirListing = true;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	foreach (OCA\Files_Trashbin\Helper::getTrashFiles($dir, \OCP\User::getUser()) as $file) {
45 45
 		$fileName = $file['name'];
46 46
 		if (!$dirListing) {
47
-			$fileName .= '.d' . $file['mtime'];
47
+			$fileName .= '.d'.$file['mtime'];
48 48
 		}
49 49
 		$list[] = $fileName;
50 50
 	}
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 $i = 0;
59 59
 foreach ($list as $file) {
60
-	$path = $dir . '/' . $file;
60
+	$path = $dir.'/'.$file;
61 61
 	if ($dir === '/') {
62 62
 		$file = ltrim($file, '/');
63 63
 		$delimiter = strrpos($file, '.d');
64 64
 		$filename = substr($file, 0, $delimiter);
65
-		$timestamp =  substr($file, $delimiter+2);
65
+		$timestamp = substr($file, $delimiter + 2);
66 66
 	} else {
67 67
 		$path_parts = pathinfo($file);
68 68
 		$filename = $path_parts['basename'];
69 69
 		$timestamp = null;
70 70
 	}
71 71
 
72
-	if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) {
72
+	if (!OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp)) {
73 73
 		$error[] = $filename;
74
-		\OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, \OCP\Util::ERROR);
74
+		\OCP\Util::writeLog('trashbin', 'can\'t restore '.$filename, \OCP\Util::ERROR);
75 75
 	} else {
76 76
 		$success[$i]['filename'] = $file;
77 77
 		$success[$i]['timestamp'] = $timestamp;
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 
81 81
 }
82 82
 
83
-if ( $error ) {
83
+if ($error) {
84 84
 	$filelist = '';
85
-	foreach ( $error as $e ) {
85
+	foreach ($error as $e) {
86 86
 		$filelist .= $e.', ';
87 87
 	}
88 88
 	$l = OC::$server->getL10N('files_trashbin');
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/list.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
 \OC::$server->getSession()->close();
26 26
 
27 27
 // Load the files
28
-$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
29
-$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name';
28
+$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : '';
29
+$sortAttribute = isset($_GET['sort']) ? (string) $_GET['sort'] : 'name';
30 30
 $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
31 31
 $data = array();
32 32
 
Please login to merge, or discard this patch.
apps/files_trashbin/ajax/delete.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
32 32
 
33 33
 // "empty trash" command
34
-if (isset($_POST['allfiles']) && (string)$_POST['allfiles'] === 'true'){
34
+if (isset($_POST['allfiles']) && (string) $_POST['allfiles'] === 'true') {
35 35
 	$deleteAll = true;
36 36
 	if ($folder === '/' || $folder === '') {
37 37
 		OCA\Files_Trashbin\Trashbin::deleteAll();
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 }
44 44
 else {
45 45
 	$deleteAll = false;
46
-	$files = (string)$_POST['files'];
46
+	$files = (string) $_POST['files'];
47 47
 	$list = json_decode($files);
48 48
 }
49 49
 
50
-$folder = rtrim($folder, '/') . '/';
50
+$folder = rtrim($folder, '/').'/';
51 51
 $error = array();
52 52
 $success = array();
53 53
 
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 		$file = ltrim($file, '/');
58 58
 		$delimiter = strrpos($file, '.d');
59 59
 		$filename = substr($file, 0, $delimiter);
60
-		$timestamp =  substr($file, $delimiter+2);
60
+		$timestamp = substr($file, $delimiter + 2);
61 61
 	} else {
62
-		$filename = $folder . '/' . $file;
62
+		$filename = $folder.'/'.$file;
63 63
 		$timestamp = null;
64 64
 	}
65 65
 
66 66
 	OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp);
67 67
 	if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
68 68
 		$error[] = $filename;
69
-		\OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR);
69
+		\OCP\Util::writeLog('trashbin', 'can\'t delete '.$filename.' permanently.', \OCP\Util::ERROR);
70 70
 	}
71 71
 	// only list deleted files if not deleting everything
72 72
 	else if (!$deleteAll) {
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	}
77 77
 }
78 78
 
79
-if ( $error ) {
79
+if ($error) {
80 80
 	$filelist = '';
81
-	foreach ( $error as $e ) {
81
+	foreach ($error as $e) {
82 82
 		$filelist .= $e.', ';
83 83
 	}
84 84
 	$l = \OC::$server->getL10N('files_trashbin');
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Trashbin.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		Filesystem::initMountPoints($uid);
96 96
 		if ($uid != User::getUser()) {
97 97
 			$info = Filesystem::getFileInfo($filename);
98
-			$ownerView = new View('/' . $uid . '/files');
98
+			$ownerView = new View('/'.$uid.'/files');
99 99
 			try {
100 100
 				$filename = $ownerView->getPath($info['fileid']);
101 101
 			} catch (NotFoundException $e) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	}
147 147
 
148 148
 	private static function setUpTrash($user) {
149
-		$view = new View('/' . $user);
149
+		$view = new View('/'.$user);
150 150
 		if (!$view->is_dir('files_trashbin')) {
151 151
 			$view->mkdir('files_trashbin');
152 152
 		}
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 
182 182
 		$view = new View('/');
183 183
 
184
-		$target = $user . '/files_trashbin/files/' . $targetFilename . '.d' . $timestamp;
185
-		$source = $owner . '/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp;
184
+		$target = $user.'/files_trashbin/files/'.$targetFilename.'.d'.$timestamp;
185
+		$source = $owner.'/files_trashbin/files/'.$sourceFilename.'.d'.$timestamp;
186 186
 		self::copy_recursive($source, $target, $view);
187 187
 
188 188
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 			$ownerPath = $file_path;
217 217
 		}
218 218
 
219
-		$ownerView = new View('/' . $owner);
219
+		$ownerView = new View('/'.$owner);
220 220
 		// file has been deleted in between
221
-		if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/' . $ownerPath)) {
221
+		if (is_null($ownerPath) || $ownerPath === '' || !$ownerView->file_exists('/files/'.$ownerPath)) {
222 222
 			return true;
223 223
 		}
224 224
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 		$timestamp = time();
236 236
 
237 237
 		// disable proxy to prevent recursive calls
238
-		$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
238
+		$trashPath = '/files_trashbin/files/'.$filename.'.d'.$timestamp;
239 239
 
240 240
 		/** @var \OC\Files\Storage\Storage $trashStorage */
241 241
 		list($trashStorage, $trashInternalPath) = $ownerView->resolvePath($trashPath);
242 242
 		/** @var \OC\Files\Storage\Storage $sourceStorage */
243
-		list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/' . $ownerPath);
243
+		list($sourceStorage, $sourceInternalPath) = $ownerView->resolvePath('/files/'.$ownerPath);
244 244
 		try {
245 245
 			$moveSuccessful = true;
246 246
 			if ($trashStorage->file_exists($trashInternalPath)) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			if ($trashStorage->file_exists($trashInternalPath)) {
253 253
 				$trashStorage->unlink($trashInternalPath);
254 254
 			}
255
-			\OCP\Util::writeLog('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OCP\Util::ERROR);
255
+			\OCP\Util::writeLog('files_trashbin', 'Couldn\'t move '.$file_path.' to the trash bin', \OCP\Util::ERROR);
256 256
 		}
257 257
 
258 258
 		if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				\OCP\Util::writeLog('files_trashbin', 'trash bin database couldn\'t be updated', \OCP\Util::ERROR);
270 270
 			}
271 271
 			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => Filesystem::normalizePath($file_path),
272
-				'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)));
272
+				'trashPath' => Filesystem::normalizePath($filename.'.d'.$timestamp)));
273 273
 
274 274
 			self::retainVersions($filename, $owner, $ownerPath, $timestamp);
275 275
 
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
 			$user = User::getUser();
304 304
 			$rootView = new View('/');
305 305
 
306
-			if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
306
+			if ($rootView->is_dir($owner.'/files_versions/'.$ownerPath)) {
307 307
 				if ($owner !== $user) {
308
-					self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView);
308
+					self::copy_recursive($owner.'/files_versions/'.$ownerPath, $owner.'/files_trashbin/versions/'.basename($ownerPath).'.d'.$timestamp, $rootView);
309 309
 				}
310
-				self::move($rootView, $owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp);
310
+				self::move($rootView, $owner.'/files_versions/'.$ownerPath, $user.'/files_trashbin/versions/'.$filename.'.d'.$timestamp);
311 311
 			} else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
312 312
 
313 313
 				foreach ($versions as $v) {
314 314
 					if ($owner !== $user) {
315
-						self::copy($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp);
315
+						self::copy($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $owner.'/files_trashbin/versions/'.$v['name'].'.v'.$v['version'].'.d'.$timestamp);
316 316
 					}
317
-					self::move($rootView, $owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp);
317
+					self::move($rootView, $owner.'/files_versions'.$v['path'].'.v'.$v['version'], $user.'/files_trashbin/versions/'.$filename.'.v'.$v['version'].'.d'.$timestamp);
318 318
 				}
319 319
 			}
320 320
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public static function restore($file, $filename, $timestamp) {
378 378
 		$user = User::getUser();
379
-		$view = new View('/' . $user);
379
+		$view = new View('/'.$user);
380 380
 
381 381
 		$location = '';
382 382
 		if ($timestamp) {
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 			} else {
387 387
 				// if location no longer exists, restore file in the root directory
388 388
 				if ($location !== '/' &&
389
-					(!$view->is_dir('files/' . $location) ||
390
-						!$view->isCreatable('files/' . $location))
389
+					(!$view->is_dir('files/'.$location) ||
390
+						!$view->isCreatable('files/'.$location))
391 391
 				) {
392 392
 					$location = '';
393 393
 				}
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 		// we need a  extension in case a file/dir with the same name already exists
398 398
 		$uniqueFilename = self::getUniqueFilename($location, $filename, $view);
399 399
 
400
-		$source = Filesystem::normalizePath('files_trashbin/files/' . $file);
401
-		$target = Filesystem::normalizePath('files/' . $location . '/' . $uniqueFilename);
400
+		$source = Filesystem::normalizePath('files_trashbin/files/'.$file);
401
+		$target = Filesystem::normalizePath('files/'.$location.'/'.$uniqueFilename);
402 402
 		if (!$view->file_exists($source)) {
403 403
 			return false;
404 404
 		}
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
 		// handle the restore result
411 411
 		if ($restoreResult) {
412 412
 			$fakeRoot = $view->getRoot();
413
-			$view->chroot('/' . $user . '/files');
414
-			$view->touch('/' . $location . '/' . $uniqueFilename, $mtime);
413
+			$view->chroot('/'.$user.'/files');
414
+			$view->touch('/'.$location.'/'.$uniqueFilename, $mtime);
415 415
 			$view->chroot($fakeRoot);
416
-			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename),
416
+			\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename),
417 417
 				'trashPath' => Filesystem::normalizePath($file)));
418 418
 
419 419
 			self::restoreVersions($view, $file, $filename, $uniqueFilename, $location, $timestamp);
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			$user = User::getUser();
448 448
 			$rootView = new View('/');
449 449
 
450
-			$target = Filesystem::normalizePath('/' . $location . '/' . $uniqueFilename);
450
+			$target = Filesystem::normalizePath('/'.$location.'/'.$uniqueFilename);
451 451
 
452 452
 			list($owner, $ownerPath) = self::getUidAndFilename($target);
453 453
 
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 				$versionedFile = $file;
463 463
 			}
464 464
 
465
-			if ($view->is_dir('/files_trashbin/versions/' . $file)) {
466
-				$rootView->rename(Filesystem::normalizePath($user . '/files_trashbin/versions/' . $file), Filesystem::normalizePath($owner . '/files_versions/' . $ownerPath));
465
+			if ($view->is_dir('/files_trashbin/versions/'.$file)) {
466
+				$rootView->rename(Filesystem::normalizePath($user.'/files_trashbin/versions/'.$file), Filesystem::normalizePath($owner.'/files_versions/'.$ownerPath));
467 467
 			} else if ($versions = self::getVersionsFromTrash($versionedFile, $timestamp, $user)) {
468 468
 				foreach ($versions as $v) {
469 469
 					if ($timestamp) {
470
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v . '.d' . $timestamp, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
470
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v.'.d'.$timestamp, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
471 471
 					} else {
472
-						$rootView->rename($user . '/files_trashbin/versions/' . $versionedFile . '.v' . $v, $owner . '/files_versions/' . $ownerPath . '.v' . $v);
472
+						$rootView->rename($user.'/files_trashbin/versions/'.$versionedFile.'.v'.$v, $owner.'/files_versions/'.$ownerPath.'.v'.$v);
473 473
 					}
474 474
 				}
475 475
 			}
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
 	 */
482 482
 	public static function deleteAll() {
483 483
 		$user = User::getUser();
484
-		$view = new View('/' . $user);
484
+		$view = new View('/'.$user);
485 485
 		$fileInfos = $view->getDirectoryContent('files_trashbin/files');
486 486
 
487 487
 		// Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore)
488 488
 		$filePaths = array();
489
-		foreach($fileInfos as $fileInfo){
489
+		foreach ($fileInfos as $fileInfo) {
490 490
 			$filePaths[] = $view->getRelativePath($fileInfo->getPath());
491 491
 		}
492 492
 		unset($fileInfos); // save memory
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		\OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', array('paths' => $filePaths));
496 496
 
497 497
 		// Single-File Hooks
498
-		foreach($filePaths as $path){
498
+		foreach ($filePaths as $path) {
499 499
 			self::emitTrashbinPreDelete($path);
500 500
 		}
501 501
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		\OC_Hook::emit('\OCP\Trashbin', 'deleteAll', array('paths' => $filePaths));
509 509
 
510 510
 		// Single-File Hooks
511
-		foreach($filePaths as $path){
511
+		foreach ($filePaths as $path) {
512 512
 			self::emitTrashbinPostDelete($path);
513 513
 		}
514 514
 
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 * wrapper function to emit the 'preDelete' hook of \OCP\Trashbin before a file is deleted
523 523
 	 * @param string $path
524 524
 	 */
525
-	protected static function emitTrashbinPreDelete($path){
525
+	protected static function emitTrashbinPreDelete($path) {
526 526
 		\OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => $path));
527 527
 	}
528 528
 
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 * wrapper function to emit the 'delete' hook of \OCP\Trashbin after a file has been deleted
531 531
 	 * @param string $path
532 532
 	 */
533
-	protected static function emitTrashbinPostDelete($path){
533
+	protected static function emitTrashbinPostDelete($path) {
534 534
 		\OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => $path));
535 535
 	}
536 536
 
@@ -544,27 +544,27 @@  discard block
 block discarded – undo
544 544
 	 * @return int size of deleted files
545 545
 	 */
546 546
 	public static function delete($filename, $user, $timestamp = null) {
547
-		$view = new View('/' . $user);
547
+		$view = new View('/'.$user);
548 548
 		$size = 0;
549 549
 
550 550
 		if ($timestamp) {
551 551
 			$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=? AND `id`=? AND `timestamp`=?');
552 552
 			$query->execute(array($user, $filename, $timestamp));
553
-			$file = $filename . '.d' . $timestamp;
553
+			$file = $filename.'.d'.$timestamp;
554 554
 		} else {
555 555
 			$file = $filename;
556 556
 		}
557 557
 
558 558
 		$size += self::deleteVersions($view, $file, $filename, $timestamp, $user);
559 559
 
560
-		if ($view->is_dir('/files_trashbin/files/' . $file)) {
561
-			$size += self::calculateSize(new View('/' . $user . '/files_trashbin/files/' . $file));
560
+		if ($view->is_dir('/files_trashbin/files/'.$file)) {
561
+			$size += self::calculateSize(new View('/'.$user.'/files_trashbin/files/'.$file));
562 562
 		} else {
563
-			$size += $view->filesize('/files_trashbin/files/' . $file);
563
+			$size += $view->filesize('/files_trashbin/files/'.$file);
564 564
 		}
565
-		self::emitTrashbinPreDelete('/files_trashbin/files/' . $file);
566
-		$view->unlink('/files_trashbin/files/' . $file);
567
-		self::emitTrashbinPostDelete('/files_trashbin/files/' . $file);
565
+		self::emitTrashbinPreDelete('/files_trashbin/files/'.$file);
566
+		$view->unlink('/files_trashbin/files/'.$file);
567
+		self::emitTrashbinPostDelete('/files_trashbin/files/'.$file);
568 568
 
569 569
 		return $size;
570 570
 	}
@@ -580,17 +580,17 @@  discard block
 block discarded – undo
580 580
 	private static function deleteVersions(View $view, $file, $filename, $timestamp, $user) {
581 581
 		$size = 0;
582 582
 		if (\OCP\App::isEnabled('files_versions')) {
583
-			if ($view->is_dir('files_trashbin/versions/' . $file)) {
584
-				$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
585
-				$view->unlink('files_trashbin/versions/' . $file);
583
+			if ($view->is_dir('files_trashbin/versions/'.$file)) {
584
+				$size += self::calculateSize(new View('/'.$user.'/files_trashbin/versions/'.$file));
585
+				$view->unlink('files_trashbin/versions/'.$file);
586 586
 			} else if ($versions = self::getVersionsFromTrash($filename, $timestamp, $user)) {
587 587
 				foreach ($versions as $v) {
588 588
 					if ($timestamp) {
589
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp);
590
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v . '.d' . $timestamp);
589
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
590
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp);
591 591
 					} else {
592
-						$size += $view->filesize('/files_trashbin/versions/' . $filename . '.v' . $v);
593
-						$view->unlink('/files_trashbin/versions/' . $filename . '.v' . $v);
592
+						$size += $view->filesize('/files_trashbin/versions/'.$filename.'.v'.$v);
593
+						$view->unlink('/files_trashbin/versions/'.$filename.'.v'.$v);
594 594
 					}
595 595
 				}
596 596
 			}
@@ -607,15 +607,15 @@  discard block
 block discarded – undo
607 607
 	 */
608 608
 	public static function file_exists($filename, $timestamp = null) {
609 609
 		$user = User::getUser();
610
-		$view = new View('/' . $user);
610
+		$view = new View('/'.$user);
611 611
 
612 612
 		if ($timestamp) {
613
-			$filename = $filename . '.d' . $timestamp;
613
+			$filename = $filename.'.d'.$timestamp;
614 614
 		} else {
615 615
 			$filename = $filename;
616 616
 		}
617 617
 
618
-		$target = Filesystem::normalizePath('files_trashbin/files/' . $filename);
618
+		$target = Filesystem::normalizePath('files_trashbin/files/'.$filename);
619 619
 		return $view->file_exists($target);
620 620
 	}
621 621
 
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	private static function calculateFreeSpace($trashbinSize, $user) {
641 641
 		$softQuota = true;
642 642
 		$userObject = \OC::$server->getUserManager()->get($user);
643
-		if(is_null($userObject)) {
643
+		if (is_null($userObject)) {
644 644
 			return 0;
645 645
 		}
646 646
 		$quota = $userObject->getQuota();
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		// subtract size of files and current trash bin size from quota
660 660
 		if ($softQuota) {
661 661
 			$userFolder = \OC::$server->getUserFolder($user);
662
-			if(is_null($userFolder)) {
662
+			if (is_null($userFolder)) {
663 663
 				return 0;
664 664
 			}
665 665
 			$free = $quota - $userFolder->getSize(); // remaining free space for user
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 			foreach ($files as $file) {
742 742
 				if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
743 743
 					$tmp = self::delete($file['name'], $user, $file['mtime']);
744
-					\OCP\Util::writeLog('files_trashbin', 'remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', \OCP\Util::INFO);
744
+					\OCP\Util::writeLog('files_trashbin', 'remove "'.$file['name'].'" ('.$tmp.'B) to meet the limit of trash bin size (50% of available quota)', \OCP\Util::INFO);
745 745
 					$availableSpace += $tmp;
746 746
 					$size += $tmp;
747 747
 				} else {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 				$count++;
772 772
 				$size += self::delete($filename, $user, $timestamp);
773 773
 				\OC::$server->getLogger()->info(
774
-					'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
774
+					'Remove "'.$filename.'" from trashbin because it exceeds max retention obligation term.',
775 775
 					['app' => 'files_trashbin']
776 776
 				);
777 777
 			} else {
@@ -797,16 +797,16 @@  discard block
 block discarded – undo
797 797
 			$view->mkdir($destination);
798 798
 			$view->touch($destination, $view->filemtime($source));
799 799
 			foreach ($view->getDirectoryContent($source) as $i) {
800
-				$pathDir = $source . '/' . $i['name'];
800
+				$pathDir = $source.'/'.$i['name'];
801 801
 				if ($view->is_dir($pathDir)) {
802
-					$size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view);
802
+					$size += self::copy_recursive($pathDir, $destination.'/'.$i['name'], $view);
803 803
 				} else {
804 804
 					$size += $view->filesize($pathDir);
805
-					$result = $view->copy($pathDir, $destination . '/' . $i['name']);
805
+					$result = $view->copy($pathDir, $destination.'/'.$i['name']);
806 806
 					if (!$result) {
807 807
 						throw new \OCA\Files_Trashbin\Exceptions\CopyRecursiveException();
808 808
 					}
809
-					$view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir));
809
+					$view->touch($destination.'/'.$i['name'], $view->filemtime($pathDir));
810 810
 				}
811 811
 			}
812 812
 		} else {
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 	 * @return array
829 829
 	 */
830 830
 	private static function getVersionsFromTrash($filename, $timestamp, $user) {
831
-		$view = new View('/' . $user . '/files_trashbin/versions');
831
+		$view = new View('/'.$user.'/files_trashbin/versions');
832 832
 		$versions = array();
833 833
 
834 834
 		//force rescan of versions, local storage may not have updated the cache
@@ -841,10 +841,10 @@  discard block
 block discarded – undo
841 841
 
842 842
 		if ($timestamp) {
843 843
 			// fetch for old versions
844
-			$matches = $view->searchRaw($filename . '.v%.d' . $timestamp);
844
+			$matches = $view->searchRaw($filename.'.v%.d'.$timestamp);
845 845
 			$offset = -strlen($timestamp) - 2;
846 846
 		} else {
847
-			$matches = $view->searchRaw($filename . '.v%');
847
+			$matches = $view->searchRaw($filename.'.v%');
848 848
 		}
849 849
 
850 850
 		if (is_array($matches)) {
@@ -874,18 +874,18 @@  discard block
 block discarded – undo
874 874
 		$name = pathinfo($filename, PATHINFO_FILENAME);
875 875
 		$l = \OC::$server->getL10N('files_trashbin');
876 876
 
877
-		$location = '/' . trim($location, '/');
877
+		$location = '/'.trim($location, '/');
878 878
 
879 879
 		// if extension is not empty we set a dot in front of it
880 880
 		if ($ext !== '') {
881
-			$ext = '.' . $ext;
881
+			$ext = '.'.$ext;
882 882
 		}
883 883
 
884
-		if ($view->file_exists('files' . $location . '/' . $filename)) {
884
+		if ($view->file_exists('files'.$location.'/'.$filename)) {
885 885
 			$i = 2;
886
-			$uniqueName = $name . " (" . $l->t("restored") . ")" . $ext;
887
-			while ($view->file_exists('files' . $location . '/' . $uniqueName)) {
888
-				$uniqueName = $name . " (" . $l->t("restored") . " " . $i . ")" . $ext;
886
+			$uniqueName = $name." (".$l->t("restored").")".$ext;
887
+			while ($view->file_exists('files'.$location.'/'.$uniqueName)) {
888
+				$uniqueName = $name." (".$l->t("restored")." ".$i.")".$ext;
889 889
 				$i++;
890 890
 			}
891 891
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 	 * @return integer size of the folder
903 903
 	 */
904 904
 	private static function calculateSize($view) {
905
-		$root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . $view->getAbsolutePath('');
905
+		$root = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').$view->getAbsolutePath('');
906 906
 		if (!file_exists($root)) {
907 907
 			return 0;
908 908
 		}
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	 * @return integer trash bin size
934 934
 	 */
935 935
 	private static function getTrashbinSize($user) {
936
-		$view = new View('/' . $user);
936
+		$view = new View('/'.$user);
937 937
 		$fileInfo = $view->getFileInfo('/files_trashbin');
938 938
 		return isset($fileInfo['size']) ? $fileInfo['size'] : 0;
939 939
 	}
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 	 */
963 963
 	public static function isEmpty($user) {
964 964
 
965
-		$view = new View('/' . $user . '/files_trashbin');
965
+		$view = new View('/'.$user.'/files_trashbin');
966 966
 		if ($view->is_dir('/files') && $dh = $view->opendir('/files')) {
967 967
 			while ($file = readdir($dh)) {
968 968
 				if (!Filesystem::isIgnoredDir($file)) {
Please login to merge, or discard this patch.
apps/files_trashbin/lib/AppInfo/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 use OCA\Files_Trashbin\Expiration;
28 28
 
29 29
 class Application extends App {
30
-	public function __construct (array $urlParams = []) {
30
+	public function __construct(array $urlParams = []) {
31 31
 		parent::__construct('files_trashbin', $urlParams);
32 32
 
33 33
 		$container = $this->getContainer();
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Command/ExpireTrash.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@
 block discarded – undo
117 117
 		\OC_Util::setupFS($user);
118 118
 
119 119
 		// Check if this user has a trashbin directory
120
-		$view = new \OC\Files\View('/' . $user);
120
+		$view = new \OC\Files\View('/'.$user);
121 121
 		if (!$view->is_dir('/files_trashbin/files')) {
122 122
 			return false;
123 123
 		}
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Command/CleanUp.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,8 +107,8 @@
 block discarded – undo
107 107
 	protected function removeDeletedFiles($uid) {
108 108
 		\OC_Util::tearDownFS();
109 109
 		\OC_Util::setupFS($uid);
110
-		if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
111
-			$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
110
+		if ($this->rootFolder->nodeExists('/'.$uid.'/files_trashbin')) {
111
+			$this->rootFolder->get('/'.$uid.'/files_trashbin')->delete();
112 112
 			$query = $this->dbConnection->getQueryBuilder();
113 113
 			$query->delete('files_trash')
114 114
 				->where($query->expr()->eq('user', $query->createParameter('uid')))
Please login to merge, or discard this patch.