use OCP\Constants;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IHomeMountProvider;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Config\IUserMountCache;
$mounts = [];
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
- $setupProviders[] = $cachedMount->getMountProvider();
$currentProviders[] = $cachedMount->getMountProvider();
if ($cachedMount->getMountProvider()) {
+ $setupProviders[] = $cachedMount->getMountProvider();
$mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]);
} else {
$this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");
if ($includeChildren) {
$subCachedMounts = $this->userMountCache->getMountsInPath($user, $path);
- foreach ($subCachedMounts as $cachedMount) {
- if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
- $setupProviders[] = $cachedMount->getMountProvider();
- $currentProviders[] = $cachedMount->getMountProvider();
- if ($cachedMount->getMountProvider()) {
+
+ $needsFullSetup = array_reduce($subCachedMounts, function (bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) {
+ return $needsFullSetup || $cachedMountInfo->getMountProvider() === '';
+ }, false);
+
+ if ($needsFullSetup) {
+ $this->logger->debug("mount has no provider set, performing full setup");
+ $this->setupForUser($user);
+ return;
+ } else {
+ foreach ($subCachedMounts as $cachedMount) {
+ if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
+ $currentProviders[] = $cachedMount->getMountProvider();
+ $setupProviders[] = $cachedMount->getMountProvider();
$mounts = array_merge($mounts, $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]));
- } else {
- $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");
- $this->setupForUser($user);
- return;
}
}
}