@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | use Psr\Log\LoggerInterface; |
| 23 | 23 | |
| 24 | 24 | class Filesystem { |
| 25 | - private static ?Mount\Manager $mounts = null; |
|
| 25 | + private static ? Mount\Manager $mounts = null; |
|
| 26 | 26 | |
| 27 | 27 | public static bool $loaded = false; |
| 28 | 28 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | public const signal_param_mount_type = 'mounttype'; |
| 150 | 150 | public const signal_param_users = 'users'; |
| 151 | 151 | |
| 152 | - private static ?\OC\Files\Storage\StorageFactory $loader = null; |
|
| 152 | + private static ? \OC\Files\Storage\StorageFactory $loader = null; |
|
| 153 | 153 | |
| 154 | 154 | private static bool $logWarningWhenAddingStorageWrapper = true; |
| 155 | 155 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | return [$mount->getStorage(), rtrim($mount->getInternalPath($path), '/')]; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - public static function init(string|IUser|null $user, string $root): bool { |
|
| 283 | + public static function init(string | IUser | null $user, string $root): bool { |
|
| 284 | 284 | if (self::$defaultInstance) { |
| 285 | 285 | return false; |
| 286 | 286 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | self::$defaultInstance = new View($root); |
| 301 | 301 | /** @var IEventDispatcher $eventDispatcher */ |
| 302 | 302 | $eventDispatcher = \OC::$server->get(IEventDispatcher::class); |
| 303 | - $eventDispatcher->addListener(FilesystemTornDownEvent::class, function () { |
|
| 303 | + $eventDispatcher->addListener(FilesystemTornDownEvent::class, function() { |
|
| 304 | 304 | self::$defaultInstance = null; |
| 305 | 305 | self::$loaded = false; |
| 306 | 306 | }); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @throws \OC\User\NoUserException if the user is not available |
| 325 | 325 | */ |
| 326 | - public static function initMountPoints(string|IUser|null $user = ''): void { |
|
| 326 | + public static function initMountPoints(string | IUser | null $user = ''): void { |
|
| 327 | 327 | /** @var IUserManager $userManager */ |
| 328 | 328 | $userManager = \OC::$server->get(IUserManager::class); |
| 329 | 329 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $session = \OC::$server->get(IUserSession::class); |
| 347 | 347 | $user = $session->getUser(); |
| 348 | 348 | if ($user) { |
| 349 | - $userDir = '/' . $user->getUID() . '/files'; |
|
| 349 | + $userDir = '/'.$user->getUID().'/files'; |
|
| 350 | 350 | self::initInternal($userDir); |
| 351 | 351 | } |
| 352 | 352 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | * we need this because we can't know if a file is stored local or not from |
| 395 | 395 | * outside the filestorage and for some purposes a local file is needed |
| 396 | 396 | */ |
| 397 | - public static function getLocalFile(string $path): string|false { |
|
| 397 | + public static function getLocalFile(string $path): string | false { |
|
| 398 | 398 | return self::$defaultInstance->getLocalFile($path); |
| 399 | 399 | } |
| 400 | 400 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | * @return string |
| 406 | 406 | */ |
| 407 | 407 | public static function getLocalPath($path) { |
| 408 | - $datadir = \OC_User::getHome(\OC_User::getUser()) . '/files'; |
|
| 408 | + $datadir = \OC_User::getHome(\OC_User::getUser()).'/files'; |
|
| 409 | 409 | $newpath = $path; |
| 410 | 410 | if (strncmp($newpath, $datadir, strlen($datadir)) == 0) { |
| 411 | 411 | $newpath = substr($path, strlen($datadir)); |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public static function isValidPath($path) { |
| 423 | 423 | $path = self::normalizePath($path); |
| 424 | 424 | if (!$path || $path[0] !== '/') { |
| 425 | - $path = '/' . $path; |
|
| 425 | + $path = '/'.$path; |
|
| 426 | 426 | } |
| 427 | 427 | if (str_contains($path, '/../') || strrchr($path, '/') === '/..') { |
| 428 | 428 | return false; |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | * @param string $path |
| 558 | 558 | * @throws \OCP\Files\InvalidPathException |
| 559 | 559 | */ |
| 560 | - public static function toTmpFile($path): string|false { |
|
| 560 | + public static function toTmpFile($path): string | false { |
|
| 561 | 561 | return self::$defaultInstance->toTmpFile($path); |
| 562 | 562 | } |
| 563 | 563 | |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | * conversion should get removed as soon as all existing |
| 626 | 626 | * function calls have been fixed. |
| 627 | 627 | */ |
| 628 | - $path = (string)$path; |
|
| 628 | + $path = (string) $path; |
|
| 629 | 629 | |
| 630 | 630 | if ($path === '') { |
| 631 | 631 | return '/'; |
@@ -647,13 +647,13 @@ discard block |
||
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | //add leading slash, if it is already there we strip it anyway |
| 650 | - $path = '/' . $path; |
|
| 650 | + $path = '/'.$path; |
|
| 651 | 651 | |
| 652 | 652 | $patterns = [ |
| 653 | - '#\\\\#s', // no windows style '\\' slashes |
|
| 653 | + '#\\\\#s', // no windows style '\\' slashes |
|
| 654 | 654 | '#/\.(/\.)*/#s', // remove '/./' |
| 655 | - '#\//+#s', // remove sequence of slashes |
|
| 656 | - '#/\.$#s', // remove trailing '/.' |
|
| 655 | + '#\//+#s', // remove sequence of slashes |
|
| 656 | + '#/\.$#s', // remove trailing '/.' |
|
| 657 | 657 | ]; |
| 658 | 658 | |
| 659 | 659 | do { |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | /** |
| 734 | 734 | * get the ETag for a file or folder |
| 735 | 735 | */ |
| 736 | - public static function getETag(string $path): string|false { |
|
| 736 | + public static function getETag(string $path): string | false { |
|
| 737 | 737 | return self::$defaultInstance->getETag($path); |
| 738 | 738 | } |
| 739 | 739 | } |