@@ -276,18 +276,20 @@ private function oneTimeUserSetup(IUser $user) {
276276 private function afterUserFullySetup (IUser $ user , array $ previouslySetupProviders ): void {
277277 $ this ->eventLogger ->start ('fs:setup:user:full:post ' , 'Housekeeping after user is setup ' );
278278 $ userRoot = '/ ' . $ user ->getUID () . '/ ' ;
279- $ mounts = $ this ->mountManager ->getAll ();
280- $ mounts = array_filter ($ mounts , function (IMountPoint $ mount ) use ($ userRoot ) {
281- return str_starts_with ($ mount ->getMountPoint (), $ userRoot );
282- });
283279 $ allProviders = array_map (function ($ provider ) {
284280 return get_class ($ provider );
285281 }, array_merge ($ this ->mountProviderCollection ->getProviders (), $ this ->mountProviderCollection ->getHomeProviders ()));
286282 $ newProviders = array_diff ($ allProviders , $ previouslySetupProviders );
287- $ mounts = array_filter ($ mounts , function (IMountPoint $ mount ) use ($ previouslySetupProviders ) {
288- return !in_array ($ mount ->getMountProvider (), $ previouslySetupProviders );
289- });
290- $ this ->userMountCache ->registerMounts ($ user , $ mounts , $ newProviders );
283+ if (count ($ newProviders ) > 0 ) {
284+ $ mounts = $ this ->mountManager ->getAll ();
285+ $ mounts = array_filter ($ mounts , function (IMountPoint $ mount ) use ($ userRoot , $ previouslySetupProviders ) {
286+ if (!str_starts_with ($ mount ->getMountPoint (), $ userRoot )) {
287+ return false ;
288+ }
289+ return !in_array ($ mount ->getMountProvider (), $ previouslySetupProviders );
290+ });
291+ $ this ->userMountCache ->registerMounts ($ user , $ mounts , $ newProviders );
292+ }
291293
292294 $ cacheDuration = $ this ->config ->getSystemValueInt ('fs_mount_cache_duration ' , 5 * 60 );
293295 if ($ cacheDuration > 0 ) {
0 commit comments