@@ -82,6 +82,7 @@ class SetupManager {
8282 private IConfig $ config ;
8383 private bool $ listeningForProviders ;
8484 private array $ fullSetupRequired = [];
85+ private bool $ setupBuiltinWrappersDone = false ;
8586
8687 public function __construct (
8788 IEventLogger $ eventLogger ,
@@ -121,6 +122,15 @@ public function isSetupComplete(IUser $user): bool {
121122 }
122123
123124 private function setupBuiltinWrappers () {
125+ if ($ this ->setupBuiltinWrappersDone ) {
126+ return ;
127+ }
128+ $ this ->setupBuiltinWrappersDone = true ;
129+
130+ // load all filesystem apps before, so no setup-hook gets lost
131+ OC_App::loadApps (['filesystem ' ]);
132+ $ prevLogging = Filesystem::logWarningWhenAddingStorageWrapper (false );
133+
124134 Filesystem::addStorageWrapper ('mount_options ' , function ($ mountPoint , IStorage $ storage , IMountPoint $ mount ) {
125135 if ($ storage ->instanceOfStorage (Common::class)) {
126136 $ storage ->setMountOptions ($ mount ->getOptions ());
@@ -188,6 +198,8 @@ private function setupBuiltinWrappers() {
188198 }
189199 return $ storage ;
190200 });
201+
202+ Filesystem::logWarningWhenAddingStorageWrapper ($ prevLogging );
191203 }
192204
193205 /**
@@ -223,6 +235,9 @@ private function oneTimeUserSetup(IUser $user) {
223235 return ;
224236 }
225237 $ this ->setupUsers [] = $ user ->getUID ();
238+
239+ $ this ->setupBuiltinWrappers ();
240+
226241 $ prevLogging = Filesystem::logWarningWhenAddingStorageWrapper (false );
227242
228243 OC_Hook::emit ('OC_Filesystem ' , 'preSetup ' , ['user ' => $ user ->getUID ()]);
@@ -321,14 +336,8 @@ public function setupRoot(): void {
321336
322337 $ this ->eventLogger ->start ('setup_root_fs ' , 'Setup root filesystem ' );
323338
324- // load all filesystem apps before, so no setup-hook gets lost
325- OC_App::loadApps (['filesystem ' ]);
326- $ prevLogging = Filesystem::logWarningWhenAddingStorageWrapper (false );
327-
328339 $ this ->setupBuiltinWrappers ();
329340
330- Filesystem::logWarningWhenAddingStorageWrapper ($ prevLogging );
331-
332341 $ rootMounts = $ this ->mountProviderCollection ->getRootMounts ();
333342 foreach ($ rootMounts as $ rootMountProvider ) {
334343 $ this ->mountManager ->addMount ($ rootMountProvider );
0 commit comments