Passed
Push — master ( 1eb084...1c074e )
by Morris
13:12 queued 11s
created
lib/private/Files/Cache/Cache.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader) {
184 184
 		//fix types
185
-		$data['fileid'] = (int)$data['fileid'];
186
-		$data['parent'] = (int)$data['parent'];
185
+		$data['fileid'] = (int) $data['fileid'];
186
+		$data['parent'] = (int) $data['parent'];
187 187
 		$data['size'] = 0 + $data['size'];
188
-		$data['mtime'] = (int)$data['mtime'];
189
-		$data['storage_mtime'] = (int)$data['storage_mtime'];
190
-		$data['encryptedVersion'] = (int)$data['encrypted'];
191
-		$data['encrypted'] = (bool)$data['encrypted'];
188
+		$data['mtime'] = (int) $data['mtime'];
189
+		$data['storage_mtime'] = (int) $data['storage_mtime'];
190
+		$data['encryptedVersion'] = (int) $data['encrypted'];
191
+		$data['encrypted'] = (bool) $data['encrypted'];
192 192
 		$data['storage_id'] = $data['storage'];
193
-		$data['storage'] = (int)$data['storage'];
193
+		$data['storage'] = (int) $data['storage'];
194 194
 		$data['mimetype'] = $mimetypeLoader->getMimetypeById($data['mimetype']);
195 195
 		$data['mimepart'] = $mimetypeLoader->getMimetypeById($data['mimepart']);
196 196
 		if ($data['storage_mtime'] == 0) {
197 197
 			$data['storage_mtime'] = $data['mtime'];
198 198
 		}
199
-		$data['permissions'] = (int)$data['permissions'];
199
+		$data['permissions'] = (int) $data['permissions'];
200 200
 		if (isset($data['creation_time'])) {
201
-			$data['creation_time'] = (int)$data['creation_time'];
201
+			$data['creation_time'] = (int) $data['creation_time'];
202 202
 		}
203 203
 		if (isset($data['upload_time'])) {
204
-			$data['upload_time'] = (int)$data['upload_time'];
204
+			$data['upload_time'] = (int) $data['upload_time'];
205 205
 		}
206 206
 		return new CacheEntry($data);
207 207
 	}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			$files = $result->fetchAll();
235 235
 			$result->closeCursor();
236 236
 
237
-			return array_map(function (array $data) {
237
+			return array_map(function(array $data) {
238 238
 				return self::cacheEntryFromData($data, $this->mimetypeLoader);
239 239
 			}, $files);
240 240
 		}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 			$query->update('filecache')
365 365
 				->whereFileId($id)
366
-				->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) {
366
+				->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) {
367 367
 					return $query->expr()->orX(
368 368
 						$query->expr()->neq($key, $query->createNamedParameter($value)),
369 369
 						$query->expr()->isNull($key)
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				$query = $this->getQueryBuilder();
393 393
 				$query->update('filecache_extended')
394 394
 					->whereFileId($id)
395
-					->andWhere($query->expr()->orX(...array_map(function ($key, $value) use ($query) {
395
+					->andWhere($query->expr()->orX(...array_map(function($key, $value) use ($query) {
396 396
 						return $query->expr()->orX(
397 397
 							$query->expr()->neq($key, $query->createNamedParameter($value)),
398 398
 							$query->expr()->isNull($key)
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 		$id = $result->fetchOne();
490 490
 		$result->closeCursor();
491 491
 
492
-		return $id === false ? -1 : (int)$id;
492
+		return $id === false ? -1 : (int) $id;
493 493
 	}
494 494
 
495 495
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			return -1;
504 504
 		} else {
505 505
 			$parent = $this->getParentPath($file);
506
-			return (int)$this->getId($parent);
506
+			return (int) $this->getId($parent);
507 507
 		}
508 508
 	}
509 509
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 */
563 563
 	private function getSubFolders(ICacheEntry $entry) {
564 564
 		$children = $this->getFolderContentsById($entry->getId());
565
-		return array_filter($children, function ($child) {
565
+		return array_filter($children, function($child) {
566 566
 			return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER;
567 567
 		});
568 568
 	}
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 		// and collecting all folder ids to later use to delete the filecache entries
582 582
 		while ($entryId = array_pop($queue)) {
583 583
 			$children = $this->getFolderContentsById($entryId);
584
-			$childIds = array_map(function (ICacheEntry $cacheEntry) {
584
+			$childIds = array_map(function(ICacheEntry $cacheEntry) {
585 585
 				return $cacheEntry->getId();
586 586
 			}, $children);
587 587
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 			$query->execute();
592 592
 
593 593
 			/** @var ICacheEntry[] $childFolders */
594
-			$childFolders = array_filter($children, function ($child) {
594
+			$childFolders = array_filter($children, function($child) {
595 595
 				return $child->getMimeType() == FileInfo::MIMETYPE_FOLDER;
596 596
 			});
597 597
 			foreach ($childFolders as $folder) {
@@ -649,10 +649,10 @@  discard block
 block discarded – undo
649 649
 			[$targetStorageId, $targetPath] = $this->getMoveInfo($targetPath);
650 650
 
651 651
 			if (is_null($sourceStorageId) || $sourceStorageId === false) {
652
-				throw new \Exception('Invalid source storage id: ' . $sourceStorageId);
652
+				throw new \Exception('Invalid source storage id: '.$sourceStorageId);
653 653
 			}
654 654
 			if (is_null($targetStorageId) || $targetStorageId === false) {
655
-				throw new \Exception('Invalid target storage id: ' . $targetStorageId);
655
+				throw new \Exception('Invalid target storage id: '.$targetStorageId);
656 656
 			}
657 657
 
658 658
 			$this->connection->beginTransaction();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 					->set('path_hash', $fun->md5($newPathFunction))
672 672
 					->set('path', $newPathFunction)
673 673
 					->where($query->expr()->eq('storage', $query->createNamedParameter($sourceStorageId, IQueryBuilder::PARAM_INT)))
674
-					->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath) . '/%')));
674
+					->andWhere($query->expr()->like('path', $query->createNamedParameter($this->connection->escapeLikeParameter($sourcePath).'/%')));
675 675
 
676 676
 				try {
677 677
 					$query->execute();
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 		$result->closeCursor();
751 751
 
752 752
 		if ($size !== false) {
753
-			if ((int)$size === -1) {
753
+			if ((int) $size === -1) {
754 754
 				return self::SHALLOW;
755 755
 			} else {
756 756
 				return self::COMPLETE;
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 		$files = $result->fetchAll();
788 788
 		$result->closeCursor();
789 789
 
790
-		return array_map(function (array $data) {
790
+		return array_map(function(array $data) {
791 791
 			return self::cacheEntryFromData($data, $this->mimetypeLoader);
792 792
 		}, $files);
793 793
 	}
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	private function searchResultToCacheEntries(IResult $result): array {
800 800
 		$files = $result->fetchAll();
801 801
 
802
-		return array_map(function (array $data) {
802
+		return array_map(function(array $data) {
803 803
 			return self::cacheEntryFromData($data, $this->mimetypeLoader);
804 804
 		}, $files);
805 805
 	}
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 		$files = $result->fetchAll();
829 829
 		$result->closeCursor();
830 830
 
831
-		return array_map(function (array $data) {
831
+		return array_map(function(array $data) {
832 832
 			return self::cacheEntryFromData($data, $this->mimetypeLoader);
833 833
 		}, $files);
834 834
 	}
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
 				->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)));
919 919
 
920 920
 			$result = $query->execute();
921
-			$size = (int)$result->fetchOne();
921
+			$size = (int) $result->fetchOne();
922 922
 			$result->closeCursor();
923 923
 
924 924
 			return $size;
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
 		$files = $result->fetchAll(\PDO::FETCH_COLUMN);
985 985
 		$result->closeCursor();
986 986
 
987
-		return array_map(function ($id) {
988
-			return (int)$id;
987
+		return array_map(function($id) {
988
+			return (int) $id;
989 989
 		}, $files);
990 990
 	}
991 991
 
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 			return null;
1036 1036
 		}
1037 1037
 
1038
-		return (string)$path;
1038
+		return (string) $path;
1039 1039
 	}
1040 1040
 
1041 1041
 	/**
@@ -1096,12 +1096,12 @@  discard block
 block discarded – undo
1096 1096
 		$data = $this->cacheEntryToArray($sourceEntry);
1097 1097
 		$fileId = $this->put($targetPath, $data);
1098 1098
 		if ($fileId <= 0) {
1099
-			throw new \RuntimeException("Failed to copy to " . $targetPath . " from cache with source data " . json_encode($data) . " ");
1099
+			throw new \RuntimeException("Failed to copy to ".$targetPath." from cache with source data ".json_encode($data)." ");
1100 1100
 		}
1101 1101
 		if ($sourceEntry->getMimeType() === ICacheEntry::DIRECTORY_MIMETYPE) {
1102 1102
 			$folderContent = $sourceCache->getFolderContentsById($sourceEntry->getId());
1103 1103
 			foreach ($folderContent as $subEntry) {
1104
-				$subTargetPath = $targetPath . '/' . $subEntry->getName();
1104
+				$subTargetPath = $targetPath.'/'.$subEntry->getName();
1105 1105
 				$this->copyFromCache($sourceCache, $subEntry, $subTargetPath);
1106 1106
 			}
1107 1107
 		}
Please login to merge, or discard this patch.
lib/private/Files/Node/Folder.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		if (!$this->isValidPath($path)) {
72 72
 			throw new NotPermittedException('Invalid path');
73 73
 		}
74
-		return $this->path . $this->normalizePath($path);
74
+		return $this->path.$this->normalizePath($path);
75 75
 	}
76 76
 
77 77
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 		if ($path === $this->path) {
86 86
 			return '/';
87
-		} elseif (strpos($path, $this->path . '/') !== 0) {
87
+		} elseif (strpos($path, $this->path.'/') !== 0) {
88 88
 			return null;
89 89
 		} else {
90 90
 			$path = substr($path, strlen($this->path));
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return bool
100 100
 	 */
101 101
 	public function isSubNode($node) {
102
-		return strpos($node->getPath(), $this->path . '/') === 0;
102
+		return strpos($node->getPath(), $this->path.'/') === 0;
103 103
 	}
104 104
 
105 105
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	public function getDirectoryListing() {
112 112
 		$folderContent = $this->view->getDirectoryContent($this->path);
113 113
 
114
-		return array_map(function (FileInfo $info) {
114
+		return array_map(function(FileInfo $info) {
115 115
 			if ($info->getMimetype() === 'httpd/unix-directory') {
116 116
 				return new Folder($this->root, $this->view, $info->getPath(), $info);
117 117
 			} else {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function search($query) {
230 230
 		if (is_string($query)) {
231
-			$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%'));
231
+			$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query.'%'));
232 232
 		}
233 233
 
234 234
 		// Limit+offset for queries with ordering
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 		$internalPath = $mount->getInternalPath($this->path);
256 256
 		$internalPath = rtrim($internalPath, '/');
257 257
 		if ($internalPath !== '') {
258
-			$internalPath = $internalPath . '/';
258
+			$internalPath = $internalPath.'/';
259 259
 		}
260 260
 
261 261
 		$subQueryLimit = $query->getLimit() > 0 ? $query->getLimit() + $query->getOffset() : 0;
262 262
 		$rootQuery = new SearchQuery(
263 263
 			new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
264
-				new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', $internalPath . '%'),
264
+				new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', $internalPath.'%'),
265 265
 				$query->getSearchOperation(),
266 266
 			]
267 267
 			),
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
 		$order = $query->getOrder();
308 308
 		if ($order) {
309
-			usort($files, function (FileInfo $a,FileInfo  $b) use ($order) {
309
+			usort($files, function(FileInfo $a, FileInfo  $b) use ($order) {
310 310
 				foreach ($order as $orderField) {
311 311
 					$cmp = $orderField->sortFileInfo($a, $b);
312 312
 					if ($cmp !== 0) {
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		}
319 319
 		$files = array_values(array_slice($files, $query->getOffset(), $query->getLimit() > 0 ? $query->getLimit() : null));
320 320
 
321
-		return array_map(function (FileInfo $file) {
321
+		return array_map(function(FileInfo $file) {
322 322
 			return $this->createNode($file->getPath(), $file);
323 323
 		}, $files);
324 324
 	}
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	private function cacheEntryToFileInfo(IMountPoint $mount, string $appendRoot, string $trimRoot, ICacheEntry $cacheEntry): FileInfo {
327 327
 		$trimLength = strlen($trimRoot);
328 328
 		$cacheEntry['internalPath'] = $cacheEntry['path'];
329
-		$cacheEntry['path'] = $appendRoot . substr($cacheEntry['path'], $trimLength);
330
-		return new \OC\Files\FileInfo($this->path . '/' . $cacheEntry['path'], $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount);
329
+		$cacheEntry['path'] = $appendRoot.substr($cacheEntry['path'], $trimLength);
330
+		return new \OC\Files\FileInfo($this->path.'/'.$cacheEntry['path'], $mount->getStorage(), $cacheEntry['internalPath'], $cacheEntry, $mount);
331 331
 	}
332 332
 
333 333
 	/**
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function searchByMime($mimetype) {
340 340
 		if (strpos($mimetype, '/') === false) {
341
-			$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'));
341
+			$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype.'/%'));
342 342
 		} else {
343 343
 			$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype));
344 344
 		}
@@ -368,38 +368,38 @@  discard block
 block discarded – undo
368 368
 		} else {
369 369
 			$user = null;
370 370
 		}
371
-		$mountsContainingFile = $mountCache->getMountsForFileId((int)$id, $user);
371
+		$mountsContainingFile = $mountCache->getMountsForFileId((int) $id, $user);
372 372
 		$mounts = $this->root->getMountsIn($this->path);
373 373
 		$mounts[] = $this->root->getMount($this->path);
374 374
 		/** @var IMountPoint[] $folderMounts */
375
-		$folderMounts = array_combine(array_map(function (IMountPoint $mountPoint) {
375
+		$folderMounts = array_combine(array_map(function(IMountPoint $mountPoint) {
376 376
 			return $mountPoint->getMountPoint();
377 377
 		}, $mounts), $mounts);
378 378
 
379 379
 		/** @var ICachedMountInfo[] $mountsContainingFile */
380
-		$mountsContainingFile = array_values(array_filter($mountsContainingFile, function (ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
380
+		$mountsContainingFile = array_values(array_filter($mountsContainingFile, function(ICachedMountInfo $cachedMountInfo) use ($folderMounts) {
381 381
 			return isset($folderMounts[$cachedMountInfo->getMountPoint()]);
382 382
 		}));
383 383
 
384 384
 		if (count($mountsContainingFile) === 0) {
385 385
 			if ($user === $this->getAppDataDirectoryName()) {
386
-				return $this->getByIdInRootMount((int)$id);
386
+				return $this->getByIdInRootMount((int) $id);
387 387
 			}
388 388
 			return [];
389 389
 		}
390 390
 
391
-		$nodes = array_map(function (ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) {
391
+		$nodes = array_map(function(ICachedMountInfo $cachedMountInfo) use ($folderMounts, $id) {
392 392
 			$mount = $folderMounts[$cachedMountInfo->getMountPoint()];
393
-			$cacheEntry = $mount->getStorage()->getCache()->get((int)$id);
393
+			$cacheEntry = $mount->getStorage()->getCache()->get((int) $id);
394 394
 			if (!$cacheEntry) {
395 395
 				return null;
396 396
 			}
397 397
 
398 398
 			// cache jails will hide the "true" internal path
399
-			$internalPath = ltrim($cachedMountInfo->getRootInternalPath() . '/' . $cacheEntry->getPath(), '/');
399
+			$internalPath = ltrim($cachedMountInfo->getRootInternalPath().'/'.$cacheEntry->getPath(), '/');
400 400
 			$pathRelativeToMount = substr($internalPath, strlen($cachedMountInfo->getRootInternalPath()));
401 401
 			$pathRelativeToMount = ltrim($pathRelativeToMount, '/');
402
-			$absolutePath = rtrim($cachedMountInfo->getMountPoint() . $pathRelativeToMount, '/');
402
+			$absolutePath = rtrim($cachedMountInfo->getMountPoint().$pathRelativeToMount, '/');
403 403
 			return $this->root->createNode($absolutePath, new \OC\Files\FileInfo(
404 404
 				$absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount,
405 405
 				\OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount))
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 
409 409
 		$nodes = array_filter($nodes);
410 410
 
411
-		return array_filter($nodes, function (Node $node) {
411
+		return array_filter($nodes, function(Node $node) {
412 412
 			return $this->getRelativePath($node->getPath());
413 413
 		});
414 414
 	}
415 415
 
416 416
 	protected function getAppDataDirectoryName(): string {
417 417
 		$instanceId = \OC::$server->getConfig()->getSystemValueString('instanceid');
418
-		return 'appdata_' . $instanceId;
418
+		return 'appdata_'.$instanceId;
419 419
 	}
420 420
 
421 421
 	/**
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
 			return [];
438 438
 		}
439 439
 
440
-		$absolutePath = '/' . ltrim($cacheEntry->getPath(), '/');
441
-		$currentPath = rtrim($this->path, '/') . '/';
440
+		$absolutePath = '/'.ltrim($cacheEntry->getPath(), '/');
441
+		$currentPath = rtrim($this->path, '/').'/';
442 442
 
443 443
 		if (strpos($absolutePath, $currentPath) !== 0) {
444 444
 			return [];
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
 		$mounts = $this->root->getMountsIn($this->path);
494 494
 		$mounts[] = $this->getMountPoint();
495 495
 
496
-		$mounts = array_filter($mounts, function (IMountPoint $mount) {
496
+		$mounts = array_filter($mounts, function(IMountPoint $mount) {
497 497
 			return $mount->getStorage();
498 498
 		});
499
-		$storageIds = array_map(function (IMountPoint $mount) {
499
+		$storageIds = array_map(function(IMountPoint $mount) {
500 500
 			return $mount->getStorage()->getCache()->getNumericStorageId();
501 501
 		}, $mounts);
502 502
 		/** @var IMountPoint[] $mountMap */
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 		 * Construct an array of the storage id with their prefix path
508 508
 		 * This helps us to filter in the final query
509 509
 		 */
510
-		$filters = array_map(function (IMountPoint $mount) {
510
+		$filters = array_map(function(IMountPoint $mount) {
511 511
 			$storage = $mount->getStorage();
512 512
 
513 513
 			$storageId = $storage->getCache()->getNumericStorageId();
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 
572 572
 			if ($filter['pathPrefix'] !== '') {
573 573
 				$storageFilter->add(
574
-					$builder->expr()->like('f.path', $builder->createNamedParameter($dbconn->escapeLikeParameter($filter['pathPrefix']) . '/%'))
574
+					$builder->expr()->like('f.path', $builder->createNamedParameter($dbconn->escapeLikeParameter($filter['pathPrefix']).'/%'))
575 575
 				);
576 576
 			}
577 577
 
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	}
600 600
 
601 601
 	private function recentParse($result, $mountMap, $mimetypeLoader) {
602
-		$files = array_filter(array_map(function (array $entry) use ($mountMap, $mimetypeLoader) {
602
+		$files = array_filter(array_map(function(array $entry) use ($mountMap, $mimetypeLoader) {
603 603
 			$mount = $mountMap[$entry['storage']];
604 604
 			$entry['internalPath'] = $entry['path'];
605 605
 			$entry['mimetype'] = $mimetypeLoader->getMimetypeById($entry['mimetype']);
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 			return $this->root->createNode($fileInfo->getPath(), $fileInfo);
613 613
 		}, $result));
614 614
 
615
-		return array_values(array_filter($files, function (Node $node) {
615
+		return array_values(array_filter($files, function(Node $node) {
616 616
 			$cacheEntry = $node->getMountPoint()->getStorage()->getCache()->get($node->getId());
617 617
 			if (!$cacheEntry) {
618 618
 				return false;
@@ -634,13 +634,13 @@  discard block
 block discarded – undo
634 634
 			$rootLength = strlen($jailRoot) + 1;
635 635
 			if ($path === $jailRoot) {
636 636
 				return $mount->getMountPoint();
637
-			} elseif (substr($path, 0, $rootLength) === $jailRoot . '/') {
638
-				return $mount->getMountPoint() . substr($path, $rootLength);
637
+			} elseif (substr($path, 0, $rootLength) === $jailRoot.'/') {
638
+				return $mount->getMountPoint().substr($path, $rootLength);
639 639
 			} else {
640 640
 				return null;
641 641
 			}
642 642
 		} else {
643
-			return $mount->getMountPoint() . $path;
643
+			return $mount->getMountPoint().$path;
644 644
 		}
645 645
 	}
646 646
 }
Please login to merge, or discard this patch.
lib/private/Search/Provider/File.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@
 block discarded – undo
65 65
 		}
66 66
 		$userFolder = $rootFolder->getUserFolder($user->getUID());
67 67
 		$fileQuery = new SearchQuery(
68
-			new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%'),
69
-			(int)$limit,
70
-			(int)$offset,
68
+			new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query.'%'),
69
+			(int) $limit,
70
+			(int) $offset,
71 71
 			[
72 72
 				new SearchOrder(ISearchOrder::DIRECTION_DESCENDING, 'mtime'),
73 73
 			],
Please login to merge, or discard this patch.
apps/files/lib/Search/FilesSearchProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	public function search(IUser $user, ISearchQuery $query): SearchResult {
104 104
 		$userFolder = $this->rootFolder->getUserFolder($user->getUID());
105 105
 		$fileQuery = new SearchQuery(
106
-			new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query->getTerm() . '%'),
106
+			new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%'.$query->getTerm().'%'),
107 107
 			$query->getLimit(),
108
-			(int)$query->getCursor(),
108
+			(int) $query->getCursor(),
109 109
 			$query->getSortOrder() === ISearchQuery::SORT_DATE_DESC ? [
110 110
 				new SearchOrder(ISearchOrder::DIRECTION_DESCENDING, 'mtime'),
111 111
 			] : [],
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
 		return SearchResult::paginated(
116 116
 			$this->l10n->t('Files'),
117
-			array_map(function (Node $result) use ($userFolder) {
117
+			array_map(function(Node $result) use ($userFolder) {
118 118
 				// Generate thumbnail url
119 119
 				$thumbnailUrl = $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', ['x' => 32, 'y' => 32, 'fileId' => $result->getId()]);
120 120
 				$path = $userFolder->getRelativePath($result->getPath());
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 					$this->urlGenerator->getAbsoluteURL($link),
134 134
 					$result->getMimetype() === FileInfo::MIMETYPE_FOLDER ? 'icon-folder' : $this->mimeTypeDetector->mimeTypeIcon($result->getMimetype())
135 135
 				);
136
-				$searchResultEntry->addAttribute('fileId', (string)$result->getId());
136
+				$searchResultEntry->addAttribute('fileId', (string) $result->getId());
137 137
 				$searchResultEntry->addAttribute('path', $path);
138 138
 				return $searchResultEntry;
139 139
 			}, $userFolder->search($fileQuery)),
Please login to merge, or discard this patch.