$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();
$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);
$this->setupUserMountProviders[$user->getUID()] = [];
}
$setupProviders = &$this->setupUserMountProviders[$user->getUID()];
+ $currentProviders = [];
try {
$cachedMount = $this->userMountCache->getMountForPath($user, $path);
$mounts = [];
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
$setupProviders[] = $cachedMount->getMountProvider();
+ $currentProviders[] = $cachedMount->getMountProvider();
$mounts = $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider());
}
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']);
});
*
* @param IUser $user
* @param IMountPoint[] $mounts
+ * @param array|null $mountProviderClasses
* @since 9.0.0
*/
- public function registerMounts(IUser $user, array $mounts);
+ public function registerMounts(IUser $user, array $mounts, array $mountProviderClasses = null);
/**
* Get all cached mounts for a user