Completed
Pull Request — master (#3643)
by Christoph
12:28
created
lib/private/Files/Node/Node.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$path = str_replace('\\', '/', $path);
289 289
 		//add leading slash
290 290
 		if ($path[0] !== '/') {
291
-			$path = '/' . $path;
291
+			$path = '/'.$path;
292 292
 		}
293 293
 		//remove duplicate slashes
294 294
 		while (strpos($path, '//') !== false) {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 */
309 309
 	public function isValidPath($path) {
310 310
 		if (!$path || $path[0] !== '/') {
311
-			$path = '/' . $path;
311
+			$path = '/'.$path;
312 312
 		}
313 313
 		if (strstr($path, '/../') || strrchr($path, '/') === '/..') {
314 314
 			return false;
@@ -389,14 +389,14 @@  discard block
 block discarded – undo
389 389
 			$this->root->emit('\OC\Files', 'preCopy', [$this, $nonExisting]);
390 390
 			$this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
391 391
 			if (!$this->view->copy($this->path, $targetPath)) {
392
-				throw new NotPermittedException('Could not copy ' . $this->path . ' to ' . $targetPath);
392
+				throw new NotPermittedException('Could not copy '.$this->path.' to '.$targetPath);
393 393
 			}
394 394
 			$targetNode = $this->root->get($targetPath);
395 395
 			$this->root->emit('\OC\Files', 'postCopy', [$this, $targetNode]);
396 396
 			$this->root->emit('\OC\Files', 'postWrite', [$targetNode]);
397 397
 			return $targetNode;
398 398
 		} else {
399
-			throw new NotPermittedException('No permission to copy to path ' . $targetPath);
399
+			throw new NotPermittedException('No permission to copy to path '.$targetPath);
400 400
 		}
401 401
 	}
402 402
 
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			$this->root->emit('\OC\Files', 'preRename', [$this, $nonExisting]);
414 414
 			$this->root->emit('\OC\Files', 'preWrite', [$nonExisting]);
415 415
 			if (!$this->view->rename($this->path, $targetPath)) {
416
-				throw new NotPermittedException('Could not move ' . $this->path . ' to ' . $targetPath);
416
+				throw new NotPermittedException('Could not move '.$this->path.' to '.$targetPath);
417 417
 			}
418 418
 			$targetNode = $this->root->get($targetPath);
419 419
 			$this->root->emit('\OC\Files', 'postRename', [$this, $targetNode]);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 			$this->path = $targetPath;
422 422
 			return $targetNode;
423 423
 		} else {
424
-			throw new NotPermittedException('No permission to move to path ' . $targetPath);
424
+			throw new NotPermittedException('No permission to move to path '.$targetPath);
425 425
 		}
426 426
 	}
427 427
 
Please login to merge, or discard this patch.
lib/private/Files/Node/Folder.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		if (!$this->isValidPath($path)) {
55 55
 			throw new NotPermittedException('Invalid path');
56 56
 		}
57
-		return $this->path . $this->normalizePath($path);
57
+		return $this->path.$this->normalizePath($path);
58 58
 	}
59 59
 
60 60
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 		if ($path === $this->path) {
69 69
 			return '/';
70
-		} else if (strpos($path, $this->path . '/') !== 0) {
70
+		} else if (strpos($path, $this->path.'/') !== 0) {
71 71
 			return null;
72 72
 		} else {
73 73
 			$path = substr($path, strlen($this->path));
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return bool
83 83
 	 */
84 84
 	public function isSubNode($node) {
85
-		return strpos($node->getPath(), $this->path . '/') === 0;
85
+		return strpos($node->getPath(), $this->path.'/') === 0;
86 86
 	}
87 87
 
88 88
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	public function getDirectoryListing() {
95 95
 		$folderContent = $this->view->getDirectoryContent($this->path);
96 96
 
97
-		return array_map(function (FileInfo $info) {
97
+		return array_map(function(FileInfo $info) {
98 98
 			if ($info->getMimetype() === 'httpd/unix-directory') {
99 99
 				return new Folder($this->root, $this->view, $info->getPath(), $info);
100 100
 			} else {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @return \OC\Files\Node\Node[]
195 195
 	 */
196 196
 	public function search($query) {
197
-		return $this->searchCommon('search', array('%' . $query . '%'));
197
+		return $this->searchCommon('search', array('%'.$query.'%'));
198 198
 	}
199 199
 
200 200
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$internalPath = $mount->getInternalPath($this->path);
232 232
 		$internalPath = rtrim($internalPath, '/');
233 233
 		if ($internalPath !== '') {
234
-			$internalPath = $internalPath . '/';
234
+			$internalPath = $internalPath.'/';
235 235
 		}
236 236
 		$internalRootLength = strlen($internalPath);
237 237
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				$result['internalPath'] = $result['path'];
244 244
 				$result['path'] = substr($result['path'], $internalRootLength);
245 245
 				$result['storage'] = $storage;
246
-				$files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount);
246
+				$files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount);
247 247
 			}
248 248
 		}
249 249
 
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
 				$results = call_user_func_array(array($cache, $method), $args);
258 258
 				foreach ($results as $result) {
259 259
 					$result['internalPath'] = $result['path'];
260
-					$result['path'] = $relativeMountPoint . $result['path'];
260
+					$result['path'] = $relativeMountPoint.$result['path'];
261 261
 					$result['storage'] = $storage;
262
-					$files[] = new \OC\Files\FileInfo($this->path . '/' . $result['path'], $storage, $result['internalPath'], $result, $mount);
262
+					$files[] = new \OC\Files\FileInfo($this->path.'/'.$result['path'], $storage, $result['internalPath'], $result, $mount);
263 263
 				}
264 264
 			}
265 265
 		}
266 266
 
267
-		return array_map(function (FileInfo $file) {
267
+		return array_map(function(FileInfo $file) {
268 268
 			return $this->createNode($file->getPath(), $file);
269 269
 		}, $files);
270 270
 	}
@@ -275,16 +275,16 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public function getById($id) {
277 277
 		$mountCache = $this->root->getUserMountCache();
278
-		$mountsContainingFile = $mountCache->getMountsForFileId((int)$id);
278
+		$mountsContainingFile = $mountCache->getMountsForFileId((int) $id);
279 279
 		$mounts = $this->root->getMountsIn($this->path);
280 280
 		$mounts[] = $this->root->getMount($this->path);
281 281
 		/** @var IMountPoint[] $folderMounts */
282
-		$folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) {
282
+		$folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) {
283 283
 			return $mountPoint->getMountPoint();
284 284
 		}, $mounts), $mounts);
285 285
 
286 286
 		/** @var ICachedMountInfo[] $mountsContainingFile */
287
-		$mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
287
+		$mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
288 288
 			return isset($folderMounts[$cachedMountInfo->getMountPoint()]);
289 289
 		}));
290 290
 
@@ -295,25 +295,25 @@  discard block
 block discarded – undo
295 295
 		// we only need to get the cache info once, since all mounts we found point to the same storage
296 296
 
297 297
 		$mount = $folderMounts[$mountsContainingFile[0]->getMountPoint()];
298
-		$cacheEntry = $mount->getStorage()->getCache()->get((int)$id);
298
+		$cacheEntry = $mount->getStorage()->getCache()->get((int) $id);
299 299
 		if (!$cacheEntry) {
300 300
 			return [];
301 301
 		}
302 302
 		// cache jails will hide the "true" internal path
303
-		$internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/');
303
+		$internalPath = ltrim($mountsContainingFile[0]->getRootInternalPath().'/'.$cacheEntry->getPath(), '/');
304 304
 
305
-		$nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) {
305
+		$nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($cacheEntry, $folderMounts, $internalPath) {
306 306
 			$mount = $folderMounts[$cachedMountInfo->getMountPoint()];
307 307
 			$pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath()));
308 308
 			$pathRelativeToMount = ltrim($pathRelativeToMount, '/');
309
-			$absolutePath = $cachedMountInfo->getMountPoint() . $pathRelativeToMount;
309
+			$absolutePath = $cachedMountInfo->getMountPoint().$pathRelativeToMount;
310 310
 			return $this->root->createNode($absolutePath, new \OC\Files\FileInfo(
311 311
 				$absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount,
312 312
 				\OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount))
313 313
 			));
314 314
 		}, $mountsContainingFile);
315 315
 
316
-		return array_filter($nodes, function (Node $node) {
316
+		return array_filter($nodes, function(Node $node) {
317 317
 			return $this->getRelativePath($node->getPath());
318 318
 		});
319 319
 	}
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 		$mounts = $this->root->getMountsIn($this->path);
358 358
 		$mounts[] = $this->getMountPoint();
359 359
 
360
-		$mounts = array_filter($mounts, function (IMountPoint $mount) {
360
+		$mounts = array_filter($mounts, function(IMountPoint $mount) {
361 361
 			return $mount->getStorage();
362 362
 		});
363
-		$storageIds = array_map(function (IMountPoint $mount) {
363
+		$storageIds = array_map(function(IMountPoint $mount) {
364 364
 			return $mount->getStorage()->getCache()->getNumericStorageId();
365 365
 		}, $mounts);
366 366
 		/** @var IMountPoint[] $mountMap */
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 
386 386
 		$result = $query->execute()->fetchAll();
387 387
 
388
-		$files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) {
388
+		$files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) {
389 389
 			$mount = $mountMap[$entry['storage']];
390 390
 			$entry['internalPath'] = $entry['path'];
391 391
 			$entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			return $this->root->createNode($fileInfo->getPath(), $fileInfo);
399 399
 		}, $result));
400 400
 
401
-		return array_values(array_filter($files, function (Node $node) {
401
+		return array_values(array_filter($files, function(Node $node) {
402 402
 			$relative = $this->getRelativePath($node->getPath());
403 403
 			return $relative !== null && $relative !== '/';
404 404
 		}));
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 			$rootLength = strlen($jailRoot) + 1;
413 413
 			if ($path === $jailRoot) {
414 414
 				return $mount->getMountPoint();
415
-			} else if (substr($path, 0, $rootLength) === $jailRoot . '/') {
416
-				return $mount->getMountPoint() . substr($path, $rootLength);
415
+			} else if (substr($path, 0, $rootLength) === $jailRoot.'/') {
416
+				return $mount->getMountPoint().substr($path, $rootLength);
417 417
 			} else {
418 418
 				return null;
419 419
 			}
420 420
 		} else {
421
-			return $mount->getMountPoint() . $path;
421
+			return $mount->getMountPoint().$path;
422 422
 		}
423 423
 	}
424 424
 }
Please login to merge, or discard this patch.
lib/private/Files/Mount/CacheMountProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@
 block discarded – undo
55 55
 	public function getMountsForUser(IUser $user, IStorageFactory $loader) {
56 56
 		$cacheBaseDir = $this->config->getSystemValue('cache_path', '');
57 57
 		if ($cacheBaseDir !== '') {
58
-			$cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID();
58
+			$cacheDir = rtrim($cacheBaseDir, '/').'/'.$user->getUID();
59 59
 			if (!file_exists($cacheDir)) {
60 60
 				mkdir($cacheDir, 0770, true);
61 61
 			}
62 62
 
63 63
 			return [
64
-				new MountPoint('\OC\Files\Storage\Local', '/' . $user->getUID() . '/cache', ['datadir' => $cacheDir, $loader])
64
+				new MountPoint('\OC\Files\Storage\Local', '/'.$user->getUID().'/cache', ['datadir' => $cacheDir, $loader])
65 65
 			];
66 66
 		} else {
67 67
 			return [];
Please login to merge, or discard this patch.
lib/private/Files/Mount/ObjectHomeMountProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 			return null;
65 65
 		}
66 66
 
67
-		return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader);
67
+		return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/'.$user->getUID(), $config['arguments'], $loader);
68 68
 	}
69 69
 
70 70
 	/**
Please login to merge, or discard this patch.
lib/private/Files/Mount/MountPoint.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		} else {
106 106
 			// Update old classes to new namespace
107 107
 			if (strpos($storage, 'OC_Filestorage_') !== false) {
108
-				$storage = '\OC\Files\Storage\\' . substr($storage, 15);
108
+				$storage = '\OC\Files\Storage\\'.substr($storage, 15);
109 109
 			}
110 110
 			$this->class = $storage;
111 111
 			$this->arguments = $arguments;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 				return;
158 158
 			}
159 159
 		} else {
160
-			\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR);
160
+			\OCP\Util::writeLog('core', 'storage backend '.$this->class.' not found', \OCP\Util::ERROR);
161 161
 			$this->invalidStorage = true;
162 162
 			return;
163 163
 		}
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function getInternalPath($path) {
209 209
 		$path = Filesystem::normalizePath($path, true, false, true);
210
-		if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
210
+		if ($this->mountPoint === $path or $this->mountPoint.'/' === $path) {
211 211
 			$internalPath = '';
212 212
 		} else {
213 213
 			$internalPath = substr($path, strlen($this->mountPoint));
214 214
 		}
215 215
 		// substr returns false instead of an empty string, we always want a string
216
-		return (string)$internalPath;
216
+		return (string) $internalPath;
217 217
 	}
218 218
 
219 219
 	/**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 */
267 267
 	public function getStorageRootId() {
268 268
 		if (is_null($this->rootId)) {
269
-			$this->rootId = (int)$this->getStorage()->getCache()->getId('');
269
+			$this->rootId = (int) $this->getStorage()->getCache()->getId('');
270 270
 		}
271 271
 		return $this->rootId;
272 272
 	}
Please login to merge, or discard this patch.
lib/private/Files/Mount/LocalHomeMountProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,6 +39,6 @@
 block discarded – undo
39 39
 	 */
40 40
 	public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
41 41
 		$arguments = ['user' => $user];
42
-		return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader);
42
+		return new MountPoint('\OC\Files\Storage\Home', '/'.$user->getUID(), $arguments, $loader);
43 43
 	}
44 44
 }
Please login to merge, or discard this patch.
lib/private/Files/Mount/Manager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 	 * @param string $mountPoint
58 58
 	 * @param string $target
59 59
 	 */
60
-	public function moveMount($mountPoint, $target){
60
+	public function moveMount($mountPoint, $target) {
61 61
 		$this->mounts[$target] = $this->mounts[$mountPoint];
62 62
 		unset($this->mounts[$mountPoint]);
63 63
 	}
Please login to merge, or discard this patch.
lib/private/Files/AppData/AppData.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 				throw new \RuntimeException('no instance id!');
74 74
 			}
75 75
 
76
-			$name = 'appdata_' . $instanceId;
76
+			$name = 'appdata_'.$instanceId;
77 77
 
78 78
 			try {
79 79
 				$appDataFolder = $this->rootFolder->get($name);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				try {
92 92
 					$appDataFolder = $appDataFolder->newFolder($this->appId);
93 93
 				} catch (NotPermittedException $e) {
94
-					throw new \RuntimeException('Could not get appdata folder for ' . $this->appId);
94
+					throw new \RuntimeException('Could not get appdata folder for '.$this->appId);
95 95
 				}
96 96
 			}
97 97
 
Please login to merge, or discard this patch.
lib/private/Files/Filesystem.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -409,17 +409,17 @@  discard block
 block discarded – undo
409 409
 		$userObject = $userManager->get($user);
410 410
 
411 411
 		if (is_null($userObject)) {
412
-			\OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, \OCP\Util::ERROR);
412
+			\OCP\Util::writeLog('files', ' Backends provided no user object for '.$user, \OCP\Util::ERROR);
413 413
 			// reset flag, this will make it possible to rethrow the exception if called again
414 414
 			unset(self::$usersSetup[$user]);
415
-			throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
415
+			throw new \OC\User\NoUserException('Backends provided no user object for '.$user);
416 416
 		}
417 417
 
418 418
 		$realUid = $userObject->getUID();
419 419
 		// workaround in case of different casings
420 420
 		if ($user !== $realUid) {
421 421
 			$stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50));
422
-			\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $realUid . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN);
422
+			\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "'.$realUid.'" got "'.$user.'". Stack: '.$stack, \OCP\Util::WARN);
423 423
 			$user = $realUid;
424 424
 
425 425
 			// again with the correct casing
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 		} else {
454 454
 			self::getMountManager()->addMount(new MountPoint(
455 455
 				new NullStorage([]),
456
-				'/' . $user
456
+				'/'.$user
457 457
 			));
458 458
 			self::getMountManager()->addMount(new MountPoint(
459 459
 				new NullStorage([]),
460
-				'/' . $user . '/files'
460
+				'/'.$user.'/files'
461 461
 			));
462 462
 		}
463 463
 		\OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user));
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	private static function listenForNewMountProviders(MountProviderCollection $mountConfigManager, IUserManager $userManager) {
473 473
 		if (!self::$listeningForProviders) {
474 474
 			self::$listeningForProviders = true;
475
-			$mountConfigManager->listen('\OC\Files\Config', 'registerMountProvider', function (IMountProvider $provider) use ($userManager) {
475
+			$mountConfigManager->listen('\OC\Files\Config', 'registerMountProvider', function(IMountProvider $provider) use ($userManager) {
476 476
 				foreach (Filesystem::$usersSetup as $user => $setup) {
477 477
 					$userObject = $userManager->get($user);
478 478
 					if ($userObject) {
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 	 * @return string
568 568
 	 */
569 569
 	static public function getLocalPath($path) {
570
-		$datadir = \OC_User::getHome(\OC_User::getUser()) . '/files';
570
+		$datadir = \OC_User::getHome(\OC_User::getUser()).'/files';
571 571
 		$newpath = $path;
572 572
 		if (strncmp($newpath, $datadir, strlen($datadir)) == 0) {
573 573
 			$newpath = substr($path, strlen($datadir));
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 	static public function isValidPath($path) {
585 585
 		$path = self::normalizePath($path);
586 586
 		if (!$path || $path[0] !== '/') {
587
-			$path = '/' . $path;
587
+			$path = '/'.$path;
588 588
 		}
589 589
 		if (strpos($path, '/../') !== false || strrchr($path, '/') === '/..') {
590 590
 			return false;
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		 *        conversion should get removed as soon as all existing
814 814
 		 *        function calls have been fixed.
815 815
 		 */
816
-		$path = (string)$path;
816
+		$path = (string) $path;
817 817
 
818 818
 		$cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]);
819 819
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 
836 836
 		//add leading slash
837 837
 		if ($path[0] !== '/') {
838
-			$path = '/' . $path;
838
+			$path = '/'.$path;
839 839
 		}
840 840
 
841 841
 		// remove '/./'
Please login to merge, or discard this patch.