diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-14 15:08:24 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-24 17:03:13 +0100 |
commit | d342c764f2f45ec6bcd026482fc4c8f2242cb132 (patch) | |
tree | d2b5b74df22cd27c4e4421c249d9213890431ec1 /lib | |
parent | 6b085b6fd162aa288da17a27a553da34e1391412 (diff) | |
download | nextcloud-server-d342c764f2f45ec6bcd026482fc4c8f2242cb132.tar.gz nextcloud-server-d342c764f2f45ec6bcd026482fc4c8f2242cb132.zip |
don't double setup provider when calling `setupForUser` after `setupForPath`
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Config/MountProviderCollection.php | 11 | ||||
-rw-r--r-- | lib/private/Files/SetupManager.php | 8 |
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index efbb54edba5..a3c20bdbfbb 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -104,14 +104,19 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { return $this->getMountsForFromProviders($user, $providers); } - public function addMountForUser(IUser $user, IMountManager $mountManager) { + public function addMountForUser(IUser $user, IMountManager $mountManager, callable $providerFilter = null) { // shared mount provider gets to go last since it needs to know existing files // to check for name collisions $firstMounts = []; - $firstProviders = array_filter($this->providers, function (IMountProvider $provider) { + if ($providerFilter) { + $providers = array_filter($this->providers, $providerFilter); + } else { + $providers = $this->providers; + } + $firstProviders = array_filter($providers, function (IMountProvider $provider) { return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); }); - $lastProviders = array_filter($this->providers, function (IMountProvider $provider) { + $lastProviders = array_filter($providers, function (IMountProvider $provider) { return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); }); foreach ($firstProviders as $provider) { diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index 7e091da0e01..e83b7448414 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -204,8 +204,14 @@ class SetupManager { } $this->setupUsersComplete[] = $user->getUID(); + if (!isset($this->setupUserMountProviders[$user->getUID()])) { + $this->setupUserMountProviders[$user->getUID()] = []; + } + $this->setupForUserWith($user, function () use ($user) { - $this->mountProviderCollection->addMountForUser($user, $this->mountManager); + $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function (IMountProvider $provider) use ($user) { + return !in_array(get_class($provider), $this->setupUserMountProviders[$user->getUID()]); + }); }); $this->userFullySetup($user); } |