use OCP\IUserSession;
use OCP\Lockdown\ILockdownManager;
use OCP\Share\Events\ShareCreatedEvent;
+use Psr\Log\LoggerInterface;
class SetupManager {
private bool $rootSetup = false;
private ILockdownManager $lockdownManager;
private IUserSession $userSession;
private ICache $cache;
+ private LoggerInterface $logger;
private bool $listeningForProviders;
public function __construct(
IUserMountCache $userMountCache,
ILockdownManager $lockdownManager,
IUserSession $userSession,
- ICacheFactory $cacheFactory
+ ICacheFactory $cacheFactory,
+ LoggerInterface $logger
) {
$this->eventLogger = $eventLogger;
$this->mountProviderCollection = $mountProviderCollection;
$this->eventDispatcher = $eventDispatcher;
$this->userMountCache = $userMountCache;
$this->lockdownManager = $lockdownManager;
+ $this->logger = $logger;
$this->userSession = $userSession;
$this->cache = $cacheFactory->createDistributed('setupmanager::');
$this->listeningForProviders = false;
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) {
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;
+ }
}
}
}
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\Lockdown\ILockdownManager;
+use Psr\Log\LoggerInterface;
class SetupManagerFactory {
private IEventLogger $eventLogger;
private IUserSession $userSession;
private ?SetupManager $setupManager;
private ICacheFactory $cacheFactory;
+ private LoggerInterface $logger;
public function __construct(
IEventLogger $eventLogger,
IUserMountCache $userMountCache,
ILockdownManager $lockdownManager,
IUserSession $userSession,
- ICacheFactory $cacheFactory
+ ICacheFactory $cacheFactory,
+ LoggerInterface $logger
) {
$this->eventLogger = $eventLogger;
$this->mountProviderCollection = $mountProviderCollection;
$this->lockdownManager = $lockdownManager;
$this->userSession = $userSession;
$this->cacheFactory = $cacheFactory;
+ $this->logger = $logger;
$this->setupManager = null;
}
$this->userMountCache,
$this->lockdownManager,
$this->userSession,
- $this->cacheFactory
+ $this->cacheFactory,
+ $this->logger
);
}
return $this->setupManager;