Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always triger setup of builtin storage wrappers #33308

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions lib/private/Files/SetupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SetupManager {
private IConfig $config;
private bool $listeningForProviders;
private array $fullSetupRequired = [];
private bool $setupBuiltinWrappersDone = false;

public function __construct(
IEventLogger $eventLogger,
Expand Down Expand Up @@ -121,6 +122,15 @@ public function isSetupComplete(IUser $user): bool {
}

private function setupBuiltinWrappers() {
if ($this->setupBuiltinWrappersDone) {
return;
}
$this->setupBuiltinWrappersDone = true;

// load all filesystem apps before, so no setup-hook gets lost
OC_App::loadApps(['filesystem']);
$prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false);

Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) {
if ($storage->instanceOfStorage(Common::class)) {
$storage->setMountOptions($mount->getOptions());
Expand Down Expand Up @@ -188,6 +198,8 @@ private function setupBuiltinWrappers() {
}
return $storage;
});

Filesystem::logWarningWhenAddingStorageWrapper($prevLogging);
}

/**
Expand Down Expand Up @@ -223,6 +235,9 @@ private function oneTimeUserSetup(IUser $user) {
return;
}
$this->setupUsers[] = $user->getUID();

$this->setupBuiltinWrappers();

$prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false);

OC_Hook::emit('OC_Filesystem', 'preSetup', ['user' => $user->getUID()]);
Expand Down Expand Up @@ -321,14 +336,8 @@ public function setupRoot(): void {

$this->eventLogger->start('setup_root_fs', 'Setup root filesystem');

// load all filesystem apps before, so no setup-hook gets lost
OC_App::loadApps(['filesystem']);
$prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false);

$this->setupBuiltinWrappers();

Filesystem::logWarningWhenAddingStorageWrapper($prevLogging);

$rootMounts = $this->mountProviderCollection->getRootMounts();
foreach ($rootMounts as $rootMountProvider) {
$this->mountManager->addMount($rootMountProvider);
Expand Down