@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | private function setupBuiltinWrappers() { |
124 | - Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
124 | + Filesystem::addStorageWrapper('mount_options', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
125 | 125 | if ($storage->instanceOfStorage(Common::class)) { |
126 | 126 | $storage->setMountOptions($mount->getOptions()); |
127 | 127 | } |
128 | 128 | return $storage; |
129 | 129 | }); |
130 | 130 | |
131 | - Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
131 | + Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
132 | 132 | if (!$mount->getOption('enable_sharing', true)) { |
133 | 133 | return new PermissionsMask([ |
134 | 134 | 'storage' => $storage, |
@@ -139,21 +139,21 @@ discard block |
||
139 | 139 | }); |
140 | 140 | |
141 | 141 | // install storage availability wrapper, before most other wrappers |
142 | - Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, IStorage $storage) { |
|
142 | + Filesystem::addStorageWrapper('oc_availability', function($mountPoint, IStorage $storage) { |
|
143 | 143 | if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
144 | 144 | return new Availability(['storage' => $storage]); |
145 | 145 | } |
146 | 146 | return $storage; |
147 | 147 | }); |
148 | 148 | |
149 | - Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
149 | + Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
150 | 150 | if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
151 | 151 | return new Encoding(['storage' => $storage]); |
152 | 152 | } |
153 | 153 | return $storage; |
154 | 154 | }); |
155 | 155 | |
156 | - Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { |
|
156 | + Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) { |
|
157 | 157 | // set up quota for home storages, even for other users |
158 | 158 | // which can happen when using sharing |
159 | 159 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return $storage; |
173 | 173 | }); |
174 | 174 | |
175 | - Filesystem::addStorageWrapper('readonly', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
175 | + Filesystem::addStorageWrapper('readonly', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
176 | 176 | /* |
177 | 177 | * Do not allow any operations that modify the storage |
178 | 178 | */ |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | |
206 | 206 | $previouslySetupProviders = $this->setupUserMountProviders[$user->getUID()]; |
207 | 207 | |
208 | - $this->setupForUserWith($user, function () use ($user) { |
|
209 | - $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function ( |
|
208 | + $this->setupForUserWith($user, function() use ($user) { |
|
209 | + $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function( |
|
210 | 210 | IMountProvider $provider |
211 | 211 | ) use ($user) { |
212 | 212 | return !in_array(get_class($provider), $this->setupUserMountProviders[$user->getUID()]); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | Filesystem::logWarningWhenAddingStorageWrapper($prevLogging); |
231 | 231 | |
232 | - $userDir = '/' . $user->getUID() . '/files'; |
|
232 | + $userDir = '/'.$user->getUID().'/files'; |
|
233 | 233 | |
234 | 234 | Filesystem::initInternal($userDir); |
235 | 235 | |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | } else { |
246 | 246 | $this->mountManager->addMount(new MountPoint( |
247 | 247 | new NullStorage([]), |
248 | - '/' . $user->getUID() |
|
248 | + '/'.$user->getUID() |
|
249 | 249 | )); |
250 | 250 | $this->mountManager->addMount(new MountPoint( |
251 | 251 | new NullStorage([]), |
252 | - '/' . $user->getUID() . '/files' |
|
252 | + '/'.$user->getUID().'/files' |
|
253 | 253 | )); |
254 | 254 | $this->setupUsersComplete[] = $user->getUID(); |
255 | 255 | } |
@@ -261,16 +261,16 @@ discard block |
||
261 | 261 | * Final housekeeping after a user has been fully setup |
262 | 262 | */ |
263 | 263 | private function afterUserFullySetup(IUser $user, array $previouslySetupProviders): void { |
264 | - $userRoot = '/' . $user->getUID() . '/'; |
|
264 | + $userRoot = '/'.$user->getUID().'/'; |
|
265 | 265 | $mounts = $this->mountManager->getAll(); |
266 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot) { |
|
266 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($userRoot) { |
|
267 | 267 | return strpos($mount->getMountPoint(), $userRoot) === 0; |
268 | 268 | }); |
269 | - $allProviders = array_map(function (IMountProvider $provider) { |
|
269 | + $allProviders = array_map(function(IMountProvider $provider) { |
|
270 | 270 | return get_class($provider); |
271 | 271 | }, $this->mountProviderCollection->getProviders()); |
272 | 272 | $newProviders = array_diff($allProviders, $previouslySetupProviders); |
273 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($previouslySetupProviders) { |
|
273 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($previouslySetupProviders) { |
|
274 | 274 | return !in_array($mount->getMountProvider(), $previouslySetupProviders); |
275 | 275 | }); |
276 | 276 | $this->userMountCache->registerMounts($user, $mounts, $newProviders); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user->getUID()]); |
305 | 305 | |
306 | - $userDir = '/' . $user->getUID() . '/files'; |
|
306 | + $userDir = '/'.$user->getUID().'/files'; |
|
307 | 307 | OC_Hook::emit('OC_Filesystem', 'setup', ['user' => $user->getUID(), 'user_dir' => $userDir]); |
308 | 308 | |
309 | 309 | $this->eventLogger->end('setup_fs'); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | } else { |
351 | 351 | return null; |
352 | 352 | } |
353 | - } elseif (strpos($path, '/appdata_' . \OC_Util::getInstanceId()) === 0 || strpos($path, '/files_external/') === 0) { |
|
353 | + } elseif (strpos($path, '/appdata_'.\OC_Util::getInstanceId()) === 0 || strpos($path, '/files_external/') === 0) { |
|
354 | 354 | return null; |
355 | 355 | } else { |
356 | 356 | [, $userId] = explode('/', $path); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | } |
380 | 380 | |
381 | 381 | // for the user's home folder, it's always the home mount |
382 | - if (rtrim($path) === "/" . $user->getUID() . "/files") { |
|
382 | + if (rtrim($path) === "/".$user->getUID()."/files") { |
|
383 | 383 | if ($includeChildren) { |
384 | 384 | $this->setupForUser($user); |
385 | 385 | } else { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | if ($cachedMount->getMountProvider()) { |
409 | 409 | $mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]); |
410 | 410 | } else { |
411 | - $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup"); |
|
411 | + $this->logger->debug("mount at ".$cachedMount->getMountPoint()." has no provider set, performing full setup"); |
|
412 | 412 | $this->setupForUser($user); |
413 | 413 | return; |
414 | 414 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | if ($cachedMount->getMountProvider()) { |
424 | 424 | $mounts = array_merge($mounts, $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()])); |
425 | 425 | } else { |
426 | - $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup"); |
|
426 | + $this->logger->debug("mount at ".$cachedMount->getMountPoint()." has no provider set, performing full setup"); |
|
427 | 427 | $this->setupForUser($user); |
428 | 428 | return; |
429 | 429 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | if (count($mounts)) { |
435 | 435 | $this->userMountCache->registerMounts($user, $mounts, $currentProviders); |
436 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
436 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
437 | 437 | array_walk($mounts, [$this->mountManager, 'addMount']); |
438 | 438 | }); |
439 | 439 | } elseif (!$this->isSetupStarted($user)) { |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | } |
473 | 473 | |
474 | 474 | // home providers are always used |
475 | - $providers = array_filter($providers, function (string $provider) { |
|
475 | + $providers = array_filter($providers, function(string $provider) { |
|
476 | 476 | return !is_subclass_of($provider, IHomeMountProvider::class); |
477 | 477 | }); |
478 | 478 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | } |
495 | 495 | |
496 | 496 | $this->userMountCache->registerMounts($user, $mounts, $providers); |
497 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
497 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
498 | 498 | array_walk($mounts, [$this->mountManager, 'addMount']); |
499 | 499 | }); |
500 | 500 | } |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | private function listenForNewMountProviders() { |
516 | 516 | if (!$this->listeningForProviders) { |
517 | 517 | $this->listeningForProviders = true; |
518 | - $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function ( |
|
518 | + $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function( |
|
519 | 519 | IMountProvider $provider |
520 | 520 | ) { |
521 | 521 | foreach ($this->setupUsers as $userId) { |
@@ -533,16 +533,16 @@ discard block |
||
533 | 533 | // note that this event handling is intentionally pessimistic |
534 | 534 | // clearing the cache to often is better than not enough |
535 | 535 | |
536 | - $this->eventDispatcher->addListener(UserAddedEvent::class, function (UserAddedEvent $event) { |
|
536 | + $this->eventDispatcher->addListener(UserAddedEvent::class, function(UserAddedEvent $event) { |
|
537 | 537 | $this->cache->remove($event->getUser()->getUID()); |
538 | 538 | }); |
539 | - $this->eventDispatcher->addListener(UserRemovedEvent::class, function (UserRemovedEvent $event) { |
|
539 | + $this->eventDispatcher->addListener(UserRemovedEvent::class, function(UserRemovedEvent $event) { |
|
540 | 540 | $this->cache->remove($event->getUser()->getUID()); |
541 | 541 | }); |
542 | - $this->eventDispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) { |
|
542 | + $this->eventDispatcher->addListener(ShareCreatedEvent::class, function(ShareCreatedEvent $event) { |
|
543 | 543 | $this->cache->remove($event->getShare()->getSharedWith()); |
544 | 544 | }); |
545 | - $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function (InvalidateMountCacheEvent $event |
|
545 | + $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function(InvalidateMountCacheEvent $event |
|
546 | 546 | ) { |
547 | 547 | if ($user = $event->getUser()) { |
548 | 548 | $this->cache->remove($user->getUID()); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | ]; |
560 | 560 | |
561 | 561 | foreach ($genericEvents as $genericEvent) { |
562 | - $this->eventDispatcher->addListener($genericEvent, function ($event) { |
|
562 | + $this->eventDispatcher->addListener($genericEvent, function($event) { |
|
563 | 563 | $this->cache->clear(); |
564 | 564 | }); |
565 | 565 | } |