Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-08 19:13:06 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-24 19:01:42 +0300
commit55d943fd4b35c9df3e3639d6f264e4f8d8df82f0 (patch)
tree262c98393f9d7053a2f5755ecec949d658d0bb43 /lib/private/Files
parent469a684d45a3424a4ddd51a023f7b18fec0d950f (diff)
fixed when accessing static filesystem calls before setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Filesystem.php27
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);
}
/**