mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
fixed when accessing static filesystem calls before setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
469a684d45
commit
55d943fd4b
1 changed files with 23 additions and 4 deletions
|
|
@ -46,6 +46,7 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Files\Storage\IStorageFactory;
|
||||
use OCP\IUser;
|
||||
use OCP\IUserManager;
|
||||
use OCP\IUserSession;
|
||||
|
||||
class Filesystem {
|
||||
|
||||
|
|
@ -321,6 +322,18 @@ class Filesystem {
|
|||
}
|
||||
|
||||
public static function init($user, $root) {
|
||||
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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue