diff options
author | Robin Appelman <robin@icewind.nl> | 2016-05-17 21:40:55 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-05-17 21:40:55 +0200 |
commit | de5b7609f96e166b96b7380e62d32ac51d85d50f (patch) | |
tree | 4abf914475773f70294ad4be8dad6c00871dca37 /lib/private/Files/Filesystem.php | |
parent | 7dbdf2f7e0192b77761a3f3eb90aa7c39b240e21 (diff) | |
download | nextcloud-server-de5b7609f96e166b96b7380e62d32ac51d85d50f.tar.gz nextcloud-server-de5b7609f96e166b96b7380e62d32ac51d85d50f.zip |
use mount providers to setup home storages (#24567)
Diffstat (limited to 'lib/private/Files/Filesystem.php')
-rw-r--r-- | lib/private/Files/Filesystem.php | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 99c123ad1a1..70236773448 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -397,7 +397,6 @@ class Filesystem { if (isset(self::$usersSetup[$user])) { return; } - $root = \OC_User::getHome($user); $userManager = \OC::$server->getUserManager(); $userObject = $userManager->get($user); @@ -409,50 +408,26 @@ class Filesystem { self::$usersSetup[$user] = true; - $homeStorage = \OC::$server->getConfig()->getSystemValue('objectstore'); - if (!empty($homeStorage)) { - // sanity checks - if (empty($homeStorage['class'])) { - \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR); - } - if (!isset($homeStorage['arguments'])) { - $homeStorage['arguments'] = array(); - } - // instantiate object store implementation - $homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']); - // mount with home object store implementation - $homeStorage['class'] = '\OC\Files\ObjectStore\HomeObjectStoreStorage'; - } else { - $homeStorage = array( - //default home storage configuration: - 'class' => '\OC\Files\Storage\Home', - 'arguments' => array() - ); - } - $homeStorage['arguments']['user'] = $userObject; + /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */ + $mountConfigManager = \OC::$server->getMountProviderCollection(); - // check for legacy home id (<= 5.0.12) - if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) { - $homeStorage['arguments']['legacy'] = true; - } + // home mounts are handled seperate since we need to ensure this is mounted before we call the other mount providers + $homeMount = $mountConfigManager->getHomeMountForUser($userObject); - $mount = new MountPoint($homeStorage['class'], '/' . $user, $homeStorage['arguments'], self::getLoader()); - self::getMountManager()->addMount($mount); + self::getMountManager()->addMount($homeMount); - $home = \OC\Files\Filesystem::getStorage($user); + \OC\Files\Filesystem::getStorage($user); // Chance to mount for other storages - /** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */ - $mountConfigManager = \OC::$server->getMountProviderCollection(); if ($userObject) { $mounts = $mountConfigManager->getMountsForUser($userObject); array_walk($mounts, array(self::$mounts, 'addMount')); - $mounts[] = $mount; + $mounts[] = $homeMount; $mountConfigManager->registerMounts($userObject, $mounts); } self::listenForNewMountProviders($mountConfigManager, $userManager); - \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user, 'user_dir' => $root)); + \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user)); } /** |