diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-08 17:13:06 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-24 17:01:42 +0100 |
commit | 55d943fd4b35c9df3e3639d6f264e4f8d8df82f0 (patch) | |
tree | 262c98393f9d7053a2f5755ecec949d658d0bb43 /lib/private/Files/Filesystem.php | |
parent | 469a684d45a3424a4ddd51a023f7b18fec0d950f (diff) | |
download | nextcloud-server-55d943fd4b35c9df3e3639d6f264e4f8d8df82f0.tar.gz nextcloud-server-55d943fd4b35c9df3e3639d6f264e4f8d8df82f0.zip |
fixed when accessing static filesystem calls before setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Filesystem.php')
-rw-r--r-- | lib/private/Files/Filesystem.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 9db9252037f..20b44e2736a 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -46,6 +46,7 @@ use OCP\Files\NotFoundException; use OCP\Files\Storage\IStorageFactory; use OCP\IUser; use OCP\IUserManager; +use OCP\IUserSession; class Filesystem { @@ -324,6 +325,18 @@ class Filesystem { if (self::$defaultInstance) { return false; } + self::initInternal($root); + + //load custom mount config + self::initMountPoints($user); + + return true; + } + + public static function initInternal($root) { + if (self::$defaultInstance) { + return false; + } self::getLoader(); self::$defaultInstance = new View($root); /** @var IEventDispatcher $eventDispatcher */ @@ -338,9 +351,6 @@ class Filesystem { self::$mounts = \OC::$server->getMountManager(); } - //load custom mount config - self::initMountPoints($user); - self::$loaded = true; return true; @@ -378,6 +388,15 @@ class Filesystem { * @return View */ public static function getView() { + if (!self::$defaultInstance) { + /** @var IUserSession $session */ + $session = \OC::$server->get(IUserSession::class); + $user = $session->getUser(); + if ($user) { + $userDir = '/' . $user->getUID() . '/files'; + self::initInternal($userDir); + } + } return self::$defaultInstance; } @@ -736,7 +755,7 @@ class Filesystem { * @return \OC\Files\FileInfo|false False if file does not exist */ public static function getFileInfo($path, $includeMountPoints = true) { - return self::$defaultInstance->getFileInfo($path, $includeMountPoints); + return self::getView()->getFileInfo($path, $includeMountPoints); } /** |