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
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-03-16 20:13:45 +0300
committerRobin Appelman <robin@icewind.nl>2022-03-24 19:03:16 +0300
commit15c9a3114aa16af35a772cefe5b3e6566c304607 (patch)
treef2558f1f9a368a41ccc279243a8204f601d9f5aa /lib
parentd342c764f2f45ec6bcd026482fc4c8f2242cb132 (diff)
perform full setup if a cached mount doesn't have a provider set
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/SetupManager.php22
-rw-r--r--lib/private/Files/SetupManagerFactory.php9
2 files changed, 26 insertions, 5 deletions
diff --git a/lib/private/Files/SetupManager.php b/lib/private/Files/SetupManager.php
index e83b7448414..6da0bf21f8f 100644
--- a/lib/private/Files/SetupManager.php
+++ b/lib/private/Files/SetupManager.php
@@ -57,6 +57,7 @@ use OCP\IUserManager;
use OCP\IUserSession;
use OCP\Lockdown\ILockdownManager;
use OCP\Share\Events\ShareCreatedEvent;
+use Psr\Log\LoggerInterface;
class SetupManager {
private bool $rootSetup = false;
@@ -75,6 +76,7 @@ class SetupManager {
private ILockdownManager $lockdownManager;
private IUserSession $userSession;
private ICache $cache;
+ private LoggerInterface $logger;
private bool $listeningForProviders;
public function __construct(
@@ -86,7 +88,8 @@ class SetupManager {
IUserMountCache $userMountCache,
ILockdownManager $lockdownManager,
IUserSession $userSession,
- ICacheFactory $cacheFactory
+ ICacheFactory $cacheFactory,
+ LoggerInterface $logger
) {
$this->eventLogger = $eventLogger;
$this->mountProviderCollection = $mountProviderCollection;
@@ -95,6 +98,7 @@ class SetupManager {
$this->eventDispatcher = $eventDispatcher;
$this->userMountCache = $userMountCache;
$this->lockdownManager = $lockdownManager;
+ $this->logger = $logger;
$this->userSession = $userSession;
$this->cache = $cacheFactory->createDistributed('setupmanager::');
$this->listeningForProviders = false;
@@ -378,7 +382,13 @@ class SetupManager {
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
$setupProviders[] = $cachedMount->getMountProvider();
$currentProviders[] = $cachedMount->getMountProvider();
- $mounts = $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider());
+ if ($cachedMount->getMountProvider()) {
+ $mounts = $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider());
+ } else {
+ $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");
+ $this->setupForUser($user);
+ return;
+ }
}
if ($includeChildren) {
@@ -387,7 +397,13 @@ class SetupManager {
if (!in_array($cachedMount->getMountProvider(), $setupProviders)) {
$setupProviders[] = $cachedMount->getMountProvider();
$currentProviders[] = $cachedMount->getMountProvider();
- $mounts = array_merge($mounts, $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider()));
+ if ($cachedMount->getMountProvider()) {
+ $mounts = array_merge($mounts, $this->mountProviderCollection->getMountsFromProvider($user, $cachedMount->getMountProvider()));
+ } else {
+ $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup");
+ $this->setupForUser($user);
+ return;
+ }
}
}
}
diff --git a/lib/private/Files/SetupManagerFactory.php b/lib/private/Files/SetupManagerFactory.php
index 122f82c02e9..d361d42aad9 100644
--- a/lib/private/Files/SetupManagerFactory.php
+++ b/lib/private/Files/SetupManagerFactory.php
@@ -32,6 +32,7 @@ use OCP\ICacheFactory;
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\Lockdown\ILockdownManager;
+use Psr\Log\LoggerInterface;
class SetupManagerFactory {
private IEventLogger $eventLogger;
@@ -43,6 +44,7 @@ class SetupManagerFactory {
private IUserSession $userSession;
private ?SetupManager $setupManager;
private ICacheFactory $cacheFactory;
+ private LoggerInterface $logger;
public function __construct(
IEventLogger $eventLogger,
@@ -52,7 +54,8 @@ class SetupManagerFactory {
IUserMountCache $userMountCache,
ILockdownManager $lockdownManager,
IUserSession $userSession,
- ICacheFactory $cacheFactory
+ ICacheFactory $cacheFactory,
+ LoggerInterface $logger
) {
$this->eventLogger = $eventLogger;
$this->mountProviderCollection = $mountProviderCollection;
@@ -62,6 +65,7 @@ class SetupManagerFactory {
$this->lockdownManager = $lockdownManager;
$this->userSession = $userSession;
$this->cacheFactory = $cacheFactory;
+ $this->logger = $logger;
$this->setupManager = null;
}
@@ -76,7 +80,8 @@ class SetupManagerFactory {
$this->userMountCache,
$this->lockdownManager,
$this->userSession,
- $this->cacheFactory
+ $this->cacheFactory,
+ $this->logger
);
}
return $this->setupManager;