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-10 17:53:39 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-24 19:01:55 +0300
commit506d29c095e0ff880605bd8e521572ed60c98438 (patch)
treecc67f8d10595919b972fb4d4423c394bc3466368 /lib/private/Files
parenta617e1e7115d7ccc01ab846981b17bee828cbcec (diff)
update cached mounts when only specific providers have been setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Config/UserMountCache.php7
-rw-r--r--lib/private/Files/SetupManager.php4
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index e5c2baa2735..6537d07393e 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -89,7 +89,7 @@ class UserMountCache implements IUserMountCache {
$this->mountsForUsers = new CappedMemoryCache();
}
- public function registerMounts(IUser $user, array $mounts) {
+ public function registerMounts(IUser $user, array $mounts, array $mountProviderClasses = null) {
// filter out non-proper storages coming from unit tests
$mounts = array_filter($mounts, function (IMountPoint $mount) {
return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache();
@@ -110,6 +110,11 @@ class UserMountCache implements IUserMountCache {
$newMounts = array_combine($newMountRootIds, $newMounts);
$cachedMounts = $this->getMountsForUser($user);
+ if (is_array($mountProviderClasses)) {
+ $cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses) {
+ return in_array($mountInfo->getMountProvider(), $mountProviderClasses);
+ });
+ }
$cachedMountRootIds = array_map(function (ICachedMountInfo $mount) {
return $mount->getRootId();
}, $cachedMounts);
diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php
index 7336e40af8a..ace408ecb49 100644
--- a/lib/private/Files/SetupManager.php
+++ b/lib/private/Files/SetupManager.php
@@ -323,6 +323,7 @@ class SetupManager {
$this->setupUserMountProviders[$user->getUID()] = [];
}
$setupProviders = &$this->setupUserMountProviders[$user->getUID()];
+ $currentProviders = [];
try {
$cachedMount = $this->userMountCache->getMountForPath($user, $path);
@@ -334,6 +335,7 @@ class SetupManager {
$mounts = [];
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
$setupProviders[] = $cachedMount->getMountProvider();
+ $currentProviders[] = $cachedMount->getMountProvider();
$mounts = $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider());
}
@@ -342,12 +344,14 @@ class SetupManager {
foreach ($subCachedMounts as $cachedMount) {
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
$setupProviders[] = $cachedMount->getMountProvider();
+ $currentProviders[] = $cachedMount->getMountProvider();
$mounts = array_merge($mounts, $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider()));
}
}
}
if (count($mounts)) {
+ $this->userMountCache->registerMounts($user, $mounts, $currentProviders);
$this->setupForUserWith($user, function () use ($mounts) {
array_walk($mounts, [$this->mountManager, 'addMount']);
});