Completed
Push — master ( 5ab16f...7c8c59 )
by
unknown
28:32
created
lib/private/Files/Config/UserMountCache.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 		$cachedMounts = $this->getMountsForUser($user);
73 73
 		if (is_array($mountProviderClasses)) {
74
-			$cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) {
74
+			$cachedMounts = array_filter($cachedMounts, function(ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) {
75 75
 				// for existing mounts that didn't have a mount provider set
76 76
 				// we still want the ones that map to new mounts
77 77
 				if ($mountInfo->getMountProvider() === '' && isset($newMounts[$mountInfo->getKey()])) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			], ['root_id', 'user_id', 'mount_point']);
175 175
 		} else {
176 176
 			// in some cases this is legitimate, like orphaned shares
177
-			$this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint());
177
+			$this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint());
178 178
 		}
179 179
 	}
180 180
 
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 		$user = new LazyUser($row['user_id'], $this->userManager);
212 212
 		$mount_id = $row['mount_id'];
213 213
 		if (!is_null($mount_id)) {
214
-			$mount_id = (int)$mount_id;
214
+			$mount_id = (int) $mount_id;
215 215
 		}
216 216
 		if ($pathCallback) {
217 217
 			return new LazyPathCachedMountInfo(
218 218
 				$user,
219
-				(int)$row['storage_id'],
220
-				(int)$row['root_id'],
219
+				(int) $row['storage_id'],
220
+				(int) $row['root_id'],
221 221
 				$row['mount_point'],
222 222
 				$row['mount_provider_class'] ?? '',
223 223
 				$mount_id,
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 		} else {
227 227
 			return new CachedMountInfo(
228 228
 				$user,
229
-				(int)$row['storage_id'],
230
-				(int)$row['root_id'],
229
+				(int) $row['storage_id'],
230
+				(int) $row['root_id'],
231 231
 				$row['mount_point'],
232 232
 				$row['mount_provider_class'] ?? '',
233 233
 				$mount_id,
@@ -339,12 +339,12 @@  discard block
 block discarded – undo
339 339
 
340 340
 			if (is_array($row)) {
341 341
 				$this->cacheInfoCache[$fileId] = [
342
-					(int)$row['storage'],
343
-					(string)$row['path'],
344
-					(int)$row['mimetype']
342
+					(int) $row['storage'],
343
+					(string) $row['path'],
344
+					(int) $row['mimetype']
345 345
 				];
346 346
 			} else {
347
-				throw new NotFoundException('File with id "' . $fileId . '" not found');
347
+				throw new NotFoundException('File with id "'.$fileId.'" not found');
348 348
 			}
349 349
 		}
350 350
 		return $this->cacheInfoCache[$fileId];
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 
400 400
 			$mounts[] = new CachedMountFileInfo(
401 401
 				new LazyUser($row['user_id'], $this->userManager),
402
-				(int)$row['storage_id'],
403
-				(int)$row['root_id'],
402
+				(int) $row['storage_id'],
403
+				(int) $row['root_id'],
404 404
 				$row['mount_point'],
405
-				$row['mount_id'] === null ? null : (int)$row['mount_id'],
405
+				$row['mount_id'] === null ? null : (int) $row['mount_id'],
406 406
 				$row['mount_provider_class'] ?? '',
407 407
 				$row['path'] ?? '',
408 408
 				$internalPath,
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$slash
457 457
 		);
458 458
 
459
-		$userIds = array_map(function (IUser $user) {
459
+		$userIds = array_map(function(IUser $user) {
460 460
 			return $user->getUID();
461 461
 		}, $users);
462 462
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 
488 488
 	public function getMountForPath(IUser $user, string $path): ICachedMountInfo {
489 489
 		$mounts = $this->getMountsForUser($user);
490
-		$mountPoints = array_map(function (ICachedMountInfo $mount) {
490
+		$mountPoints = array_map(function(ICachedMountInfo $mount) {
491 491
 			return $mount->getMountPoint();
492 492
 		}, $mounts);
493 493
 		$mounts = array_combine($mountPoints, $mounts);
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 		// walk up the directory tree until we find a path that has a mountpoint set
497 497
 		// the loop will return if a mountpoint is found or break if none are found
498 498
 		while (true) {
499
-			$mountPoint = $current . '/';
499
+			$mountPoint = $current.'/';
500 500
 			if (isset($mounts[$mountPoint])) {
501 501
 				return $mounts[$mountPoint];
502 502
 			} elseif ($current === '') {
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
 			}
510 510
 		}
511 511
 
512
-		throw new NotFoundException('No cached mount for path ' . $path);
512
+		throw new NotFoundException('No cached mount for path '.$path);
513 513
 	}
514 514
 
515 515
 	public function getMountsInPath(IUser $user, string $path): array {
516
-		$path = rtrim($path, '/') . '/';
516
+		$path = rtrim($path, '/').'/';
517 517
 		$mounts = $this->getMountsForUser($user);
518
-		return array_filter($mounts, function (ICachedMountInfo $mount) use ($path) {
518
+		return array_filter($mounts, function(ICachedMountInfo $mount) use ($path) {
519 519
 			return $mount->getMountPoint() !== $path && str_starts_with($mount->getMountPoint(), $path);
520 520
 		});
521 521
 	}
Please login to merge, or discard this patch.