mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
perform full setup if a cached mount doesn't have a provider set
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
d342c764f2
commit
15c9a3114a
2 changed files with 26 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue