@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | OC_App::loadApps(['filesystem']); |
109 | 109 | $prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false); |
110 | 110 | |
111 | - Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
111 | + Filesystem::addStorageWrapper('mount_options', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
112 | 112 | if ($storage->instanceOfStorage(Common::class)) { |
113 | 113 | $options = array_merge($mount->getOptions(), ['mount_point' => $mountPoint]); |
114 | 114 | $storage->setMountOptions($options); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $sharingEnabledForUser = $user ? !$this->shareDisableChecker->sharingDisabledForUser($user->getUID()) : true; |
122 | 122 | Filesystem::addStorageWrapper( |
123 | 123 | 'sharing_mask', |
124 | - function ($mountPoint, IStorage $storage, IMountPoint $mount) use ($reSharingEnabled, $sharingEnabledForUser) { |
|
124 | + function($mountPoint, IStorage $storage, IMountPoint $mount) use ($reSharingEnabled, $sharingEnabledForUser) { |
|
125 | 125 | $sharingEnabledForMount = $mount->getOption('enable_sharing', true); |
126 | 126 | $isShared = $mount instanceof ISharedMountPoint; |
127 | 127 | if (!$sharingEnabledForMount || !$sharingEnabledForUser || (!$reSharingEnabled && $isShared)) { |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ); |
136 | 136 | |
137 | 137 | // install storage availability wrapper, before most other wrappers |
138 | - Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
138 | + Filesystem::addStorageWrapper('oc_availability', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
139 | 139 | $externalMount = $mount instanceof ExternalMountPoint || $mount instanceof Mount; |
140 | 140 | if ($externalMount && !$storage->isLocal()) { |
141 | 141 | return new Availability(['storage' => $storage]); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | return $storage; |
144 | 144 | }); |
145 | 145 | |
146 | - Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
146 | + Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
147 | 147 | if ($mount->getOption('encoding_compatibility', false) && !$mount instanceof SharedMount) { |
148 | 148 | return new Encoding(['storage' => $storage]); |
149 | 149 | } |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | }); |
152 | 152 | |
153 | 153 | $quotaIncludeExternal = $this->config->getSystemValue('quota_include_external_storage', false); |
154 | - Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage, IMountPoint $mount) use ($quotaIncludeExternal) { |
|
154 | + Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage, IMountPoint $mount) use ($quotaIncludeExternal) { |
|
155 | 155 | // set up quota for home storages, even for other users |
156 | 156 | // which can happen when using sharing |
157 | 157 | if ($mount instanceof HomeMountPoint) { |
158 | 158 | $user = $mount->getUser(); |
159 | - return new Quota(['storage' => $storage, 'quotaCallback' => function () use ($user) { |
|
159 | + return new Quota(['storage' => $storage, 'quotaCallback' => function() use ($user) { |
|
160 | 160 | return OC_Util::getUserQuota($user); |
161 | 161 | }, 'root' => 'files', 'include_external_storage' => $quotaIncludeExternal]); |
162 | 162 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | return $storage; |
165 | 165 | }); |
166 | 166 | |
167 | - Filesystem::addStorageWrapper('readonly', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
167 | + Filesystem::addStorageWrapper('readonly', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
168 | 168 | /* |
169 | 169 | * Do not allow any operations that modify the storage |
170 | 170 | */ |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | |
202 | 202 | $previouslySetupProviders = $this->setupUserMountProviders[$user->getUID()]; |
203 | 203 | |
204 | - $this->setupForUserWith($user, function () use ($user) { |
|
205 | - $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function ( |
|
204 | + $this->setupForUserWith($user, function() use ($user) { |
|
205 | + $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function( |
|
206 | 206 | IMountProvider $provider, |
207 | 207 | ) use ($user) { |
208 | 208 | return !in_array(get_class($provider), $this->setupUserMountProviders[$user->getUID()]); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | |
238 | 238 | Filesystem::logWarningWhenAddingStorageWrapper($prevLogging); |
239 | 239 | |
240 | - $userDir = '/' . $user->getUID() . '/files'; |
|
240 | + $userDir = '/'.$user->getUID().'/files'; |
|
241 | 241 | |
242 | 242 | Filesystem::initInternal($userDir); |
243 | 243 | |
@@ -257,11 +257,11 @@ discard block |
||
257 | 257 | } else { |
258 | 258 | $this->mountManager->addMount(new MountPoint( |
259 | 259 | new NullStorage([]), |
260 | - '/' . $user->getUID() |
|
260 | + '/'.$user->getUID() |
|
261 | 261 | )); |
262 | 262 | $this->mountManager->addMount(new MountPoint( |
263 | 263 | new NullStorage([]), |
264 | - '/' . $user->getUID() . '/files' |
|
264 | + '/'.$user->getUID().'/files' |
|
265 | 265 | )); |
266 | 266 | $this->setupUsersComplete[] = $user->getUID(); |
267 | 267 | } |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | */ |
277 | 277 | private function afterUserFullySetup(IUser $user, array $previouslySetupProviders): void { |
278 | 278 | $this->eventLogger->start('fs:setup:user:full:post', 'Housekeeping after user is setup'); |
279 | - $userRoot = '/' . $user->getUID() . '/'; |
|
279 | + $userRoot = '/'.$user->getUID().'/'; |
|
280 | 280 | $mounts = $this->mountManager->getAll(); |
281 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot) { |
|
281 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($userRoot) { |
|
282 | 282 | return str_starts_with($mount->getMountPoint(), $userRoot); |
283 | 283 | }); |
284 | - $allProviders = array_map(function (IMountProvider|IHomeMountProvider|IRootMountProvider $provider) { |
|
284 | + $allProviders = array_map(function(IMountProvider | IHomeMountProvider | IRootMountProvider $provider) { |
|
285 | 285 | return get_class($provider); |
286 | 286 | }, array_merge( |
287 | 287 | $this->mountProviderCollection->getProviders(), |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $this->mountProviderCollection->getRootProviders(), |
290 | 290 | )); |
291 | 291 | $newProviders = array_diff($allProviders, $previouslySetupProviders); |
292 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($previouslySetupProviders) { |
|
292 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($previouslySetupProviders) { |
|
293 | 293 | return !in_array($mount->getMountProvider(), $previouslySetupProviders); |
294 | 294 | }); |
295 | 295 | $this->userMountCache->registerMounts($user, $mounts, $newProviders); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user->getUID()]); |
320 | 320 | $this->eventLogger->end('fs:setup:user:post-init-mountpoint'); |
321 | 321 | |
322 | - $userDir = '/' . $user->getUID() . '/files'; |
|
322 | + $userDir = '/'.$user->getUID().'/files'; |
|
323 | 323 | $this->eventLogger->start('fs:setup:user:setup-hook', 'setup legacy hook'); |
324 | 324 | OC_Hook::emit('OC_Filesystem', 'setup', ['user' => $user->getUID(), 'user_dir' => $userDir]); |
325 | 325 | $this->eventLogger->end('fs:setup:user:setup-hook'); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | } else { |
364 | 364 | return null; |
365 | 365 | } |
366 | - } elseif (str_starts_with($path, '/appdata_' . \OC_Util::getInstanceId()) || str_starts_with($path, '/files_external/')) { |
|
366 | + } elseif (str_starts_with($path, '/appdata_'.\OC_Util::getInstanceId()) || str_starts_with($path, '/files_external/')) { |
|
367 | 367 | return null; |
368 | 368 | } else { |
369 | 369 | [, $userId] = explode('/', $path); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | // for the user's home folder, and includes children we need everything always |
395 | - if (rtrim($path) === '/' . $user->getUID() . '/files' && $includeChildren) { |
|
395 | + if (rtrim($path) === '/'.$user->getUID().'/files' && $includeChildren) { |
|
396 | 396 | $this->setupForUser($user); |
397 | 397 | return; |
398 | 398 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $setupProviders[] = $cachedMount->getMountProvider(); |
423 | 423 | $mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]); |
424 | 424 | } else { |
425 | - $this->logger->debug('mount at ' . $cachedMount->getMountPoint() . ' has no provider set, performing full setup'); |
|
425 | + $this->logger->debug('mount at '.$cachedMount->getMountPoint().' has no provider set, performing full setup'); |
|
426 | 426 | $this->eventLogger->end('fs:setup:user:path:find'); |
427 | 427 | $this->setupForUser($user); |
428 | 428 | $this->eventLogger->end('fs:setup:user:path'); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $subCachedMounts = $this->userMountCache->getMountsInPath($user, $path); |
435 | 435 | $this->eventLogger->end('fs:setup:user:path:find'); |
436 | 436 | |
437 | - $needsFullSetup = array_reduce($subCachedMounts, function (bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) { |
|
437 | + $needsFullSetup = array_reduce($subCachedMounts, function(bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) { |
|
438 | 438 | return $needsFullSetup || $cachedMountInfo->getMountProvider() === ''; |
439 | 439 | }, false); |
440 | 440 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | if (count($mounts)) { |
460 | 460 | $this->userMountCache->registerMounts($user, $mounts, $currentProviders); |
461 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
461 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
462 | 462 | array_walk($mounts, [$this->mountManager, 'addMount']); |
463 | 463 | }); |
464 | 464 | } elseif (!$this->isSetupStarted($user)) { |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | return; |
502 | 502 | } |
503 | 503 | |
504 | - $this->eventLogger->start('fs:setup:user:providers', 'Setup filesystem for ' . implode(', ', $providers)); |
|
504 | + $this->eventLogger->start('fs:setup:user:providers', 'Setup filesystem for '.implode(', ', $providers)); |
|
505 | 505 | |
506 | 506 | $this->oneTimeUserSetup($user); |
507 | 507 | |
508 | 508 | // home providers are always used |
509 | - $providers = array_filter($providers, function (string $provider) { |
|
509 | + $providers = array_filter($providers, function(string $provider) { |
|
510 | 510 | return !is_subclass_of($provider, IHomeMountProvider::class); |
511 | 511 | }); |
512 | 512 | |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | } |
530 | 530 | |
531 | 531 | $this->userMountCache->registerMounts($user, $mounts, $providers); |
532 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
532 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
533 | 533 | array_walk($mounts, [$this->mountManager, 'addMount']); |
534 | 534 | }); |
535 | 535 | $this->eventLogger->end('fs:setup:user:providers'); |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | private function listenForNewMountProviders() { |
552 | 552 | if (!$this->listeningForProviders) { |
553 | 553 | $this->listeningForProviders = true; |
554 | - $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function ( |
|
554 | + $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function( |
|
555 | 555 | IMountProvider $provider, |
556 | 556 | ) { |
557 | 557 | foreach ($this->setupUsers as $userId) { |
@@ -569,16 +569,16 @@ discard block |
||
569 | 569 | // note that this event handling is intentionally pessimistic |
570 | 570 | // clearing the cache to often is better than not enough |
571 | 571 | |
572 | - $this->eventDispatcher->addListener(UserAddedEvent::class, function (UserAddedEvent $event) { |
|
572 | + $this->eventDispatcher->addListener(UserAddedEvent::class, function(UserAddedEvent $event) { |
|
573 | 573 | $this->cache->remove($event->getUser()->getUID()); |
574 | 574 | }); |
575 | - $this->eventDispatcher->addListener(UserRemovedEvent::class, function (UserRemovedEvent $event) { |
|
575 | + $this->eventDispatcher->addListener(UserRemovedEvent::class, function(UserRemovedEvent $event) { |
|
576 | 576 | $this->cache->remove($event->getUser()->getUID()); |
577 | 577 | }); |
578 | - $this->eventDispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) { |
|
578 | + $this->eventDispatcher->addListener(ShareCreatedEvent::class, function(ShareCreatedEvent $event) { |
|
579 | 579 | $this->cache->remove($event->getShare()->getSharedWith()); |
580 | 580 | }); |
581 | - $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function (InvalidateMountCacheEvent $event, |
|
581 | + $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function(InvalidateMountCacheEvent $event, |
|
582 | 582 | ) { |
583 | 583 | if ($user = $event->getUser()) { |
584 | 584 | $this->cache->remove($user->getUID()); |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | ]; |
596 | 596 | |
597 | 597 | foreach ($genericEvents as $genericEvent) { |
598 | - $this->eventDispatcher->addListener($genericEvent, function ($event) { |
|
598 | + $this->eventDispatcher->addListener($genericEvent, function($event) { |
|
599 | 599 | $this->cache->clear(); |
600 | 600 | }); |
601 | 601 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | private function getMountsFromProvider(IMountProvider $provider, IUser $user, IStorageFactory $loader): array { |
53 | 53 | $class = str_replace('\\', '_', get_class($provider)); |
54 | 54 | $uid = $user->getUID(); |
55 | - $this->eventLogger->start('fs:setup:provider:' . $class, "Getting mounts from $class for $uid"); |
|
55 | + $this->eventLogger->start('fs:setup:provider:'.$class, "Getting mounts from $class for $uid"); |
|
56 | 56 | $mounts = $provider->getMountsForUser($user, $loader) ?? []; |
57 | - $this->eventLogger->end('fs:setup:provider:' . $class); |
|
57 | + $this->eventLogger->end('fs:setup:provider:'.$class); |
|
58 | 58 | return array_values($mounts); |
59 | 59 | } |
60 | 60 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private function getUserMountsForProviders(IUser $user, array $providers): array { |
66 | 66 | $loader = $this->loader; |
67 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
67 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
68 | 68 | return $this->getMountsFromProvider($provider, $user, $loader); |
69 | 69 | }, $providers); |
70 | - $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
70 | + $mounts = array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
71 | 71 | return array_merge($mounts, $providerMounts); |
72 | 72 | }, []); |
73 | 73 | return $this->filterMounts($user, $mounts); |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | } else { |
104 | 104 | $providers = $this->providers; |
105 | 105 | } |
106 | - $firstProviders = array_filter($providers, function (IMountProvider $provider) { |
|
106 | + $firstProviders = array_filter($providers, function(IMountProvider $provider) { |
|
107 | 107 | return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); |
108 | 108 | }); |
109 | - $lastProviders = array_filter($providers, function (IMountProvider $provider) { |
|
109 | + $lastProviders = array_filter($providers, function(IMountProvider $provider) { |
|
110 | 110 | return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); |
111 | 111 | }); |
112 | 112 | foreach ($firstProviders as $provider) { |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
140 | 140 | foreach ($providers as $homeProvider) { |
141 | 141 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
142 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
142 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
143 | 143 | return $mount; |
144 | 144 | } |
145 | 145 | } |
146 | - throw new \Exception('No home storage configured for user ' . $user); |
|
146 | + throw new \Exception('No home storage configured for user '.$user); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @return list<IMountPoint> |
165 | 165 | */ |
166 | 166 | private function filterMounts(IUser $user, array $mountPoints): array { |
167 | - return array_values(array_filter($mountPoints, function (IMountPoint $mountPoint) use ($user) { |
|
167 | + return array_values(array_filter($mountPoints, function(IMountPoint $mountPoint) use ($user) { |
|
168 | 168 | foreach ($this->mountFilters as $filter) { |
169 | 169 | if ($filter($mountPoint, $user) === false) { |
170 | 170 | return false; |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function getRootMounts(): array { |
206 | 206 | $loader = $this->loader; |
207 | - $mounts = array_map(function (IRootMountProvider $provider) use ($loader) { |
|
207 | + $mounts = array_map(function(IRootMountProvider $provider) use ($loader) { |
|
208 | 208 | return $provider->getRootMounts($loader); |
209 | 209 | }, $this->rootProviders); |
210 | - $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
210 | + $mounts = array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
211 | 211 | return array_merge($mounts, $providerMounts); |
212 | 212 | }, []); |
213 | 213 |