diff options
author | Robin Appelman <robin@icewind.nl> | 2022-04-21 13:33:43 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-04-21 13:53:50 +0300 |
commit | 561a2071e4115e1a96afac343fef339a03a01c9a (patch) | |
tree | cbb6aab9e33bf2a39b77f57beecdfe9a3d6dd049 /lib/private | |
parent | caebdc2a559f995ff5672cdea7c46a5febaa1ea5 (diff) |
only register mounts that are new from providers that are new during a full setup
this fixes cases where during the (partial) setup of a shared mount a full setup is triggered
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/Config/MountProviderCollection.php | 4 | ||||
-rw-r--r-- | lib/private/Files/SetupManager.php | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index 334fce15d9e..0e08d9d0e83 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -234,4 +234,8 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { $this->homeProviders = []; $this->rootProviders = []; } + + public function getProviders(): array { + return $this->providers; + } } diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php index e0575ea92a5..f44ea7c0ab6 100644 --- a/lib/private/Files/SetupManager.php +++ b/lib/private/Files/SetupManager.php @@ -202,6 +202,8 @@ class SetupManager { $this->setupUserMountProviders[$user->getUID()] = []; } + $previouslySetupProviders = $this->setupUserMountProviders[$user->getUID()]; + $this->setupForUserWith($user, function () use ($user) { $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function ( IMountProvider $provider @@ -209,7 +211,7 @@ class SetupManager { return !in_array(get_class($provider), $this->setupUserMountProviders[$user->getUID()]); }); }); - $this->afterUserFullySetup($user); + $this->afterUserFullySetup($user, $previouslySetupProviders); } /** @@ -257,13 +259,20 @@ class SetupManager { /** * Final housekeeping after a user has been fully setup */ - private function afterUserFullySetup(IUser $user): void { + private function afterUserFullySetup(IUser $user, array $previouslySetupProviders): void { $userRoot = '/' . $user->getUID() . '/'; $mounts = $this->mountManager->getAll(); $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot) { return strpos($mount->getMountPoint(), $userRoot) === 0; }); - $this->userMountCache->registerMounts($user, $mounts); + $allProviders = array_map(function (IMountProvider $provider) { + return get_class($provider); + }, $this->mountProviderCollection->getProviders()); + $newProviders = array_diff($allProviders, $previouslySetupProviders); + $mounts = array_filter($mounts, function (IMountPoint $mount) use ($previouslySetupProviders) { + return !in_array($mount->getMountProvider(), $previouslySetupProviders); + }); + $this->userMountCache->registerMounts($user, $mounts, $newProviders); $cacheDuration = $this->config->getSystemValueInt('fs_mount_cache_duration', 5 * 60); if ($cacheDuration > 0) { |