@@ -287,7 +287,7 @@ |
||
287 | 287 | * |
288 | 288 | * @since 32.0.0 |
289 | 289 | */ |
290 | - public function getQuotaBytes(): int|float; |
|
290 | + public function getQuotaBytes(): int | float; |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * set the users' quota |
@@ -160,7 +160,7 @@ |
||
160 | 160 | return $this->getUser()->getQuota(); |
161 | 161 | } |
162 | 162 | |
163 | - public function getQuotaBytes(): int|float { |
|
163 | + public function getQuotaBytes(): int | float { |
|
164 | 164 | return $this->getUser()->getQuotaBytes(); |
165 | 165 | } |
166 | 166 |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function getLastLogin(): int { |
206 | 206 | if ($this->lastLogin === null) { |
207 | - $this->lastLogin = (int)$this->config->getUserValue($this->uid, 'login', 'lastLogin', 0); |
|
207 | + $this->lastLogin = (int) $this->config->getUserValue($this->uid, 'login', 'lastLogin', 0); |
|
208 | 208 | } |
209 | 209 | return $this->lastLogin; |
210 | 210 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function getFirstLogin(): int { |
217 | 217 | if ($this->firstLogin === null) { |
218 | - $this->firstLogin = (int)$this->config->getUserValue($this->uid, 'login', 'firstLogin', 0); |
|
218 | + $this->firstLogin = (int) $this->config->getUserValue($this->uid, 'login', 'firstLogin', 0); |
|
219 | 219 | } |
220 | 220 | return $this->firstLogin; |
221 | 221 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | if ($now - $previousLogin > 60) { |
233 | 233 | $this->lastLogin = $now; |
234 | - $this->config->setUserValue($this->uid, 'login', 'lastLogin', (string)$this->lastLogin); |
|
234 | + $this->config->setUserValue($this->uid, 'login', 'lastLogin', (string) $this->lastLogin); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | if ($firstLogin === 0) { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | /* Unknown first login, most likely was before upgrade to Nextcloud 31 */ |
242 | 242 | $this->firstLogin = -1; |
243 | 243 | } |
244 | - $this->config->setUserValue($this->uid, 'login', 'firstLogin', (string)$this->firstLogin); |
|
244 | + $this->config->setUserValue($this->uid, 'login', 'firstLogin', (string) $this->firstLogin); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $firstTimeLogin; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | if (($this->backend instanceof IGetHomeBackend || $this->backend->implementsActions(Backend::GET_HOME)) && $home = $this->backend->getHome($this->uid)) { |
390 | 390 | $this->home = $home; |
391 | 391 | } else { |
392 | - $this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $this->uid; |
|
392 | + $this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT.'/data').'/'.$this->uid; |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | return $this->home; |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @return bool |
458 | 458 | */ |
459 | 459 | public function isEnabled() { |
460 | - $queryDatabaseValue = function (): bool { |
|
460 | + $queryDatabaseValue = function(): bool { |
|
461 | 461 | if ($this->enabled === null) { |
462 | 462 | $enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true'); |
463 | 463 | $this->enabled = $enabled === 'true'; |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | */ |
479 | 479 | public function setEnabled(bool $enabled = true) { |
480 | 480 | $oldStatus = $this->isEnabled(); |
481 | - $setDatabaseValue = function (bool $enabled): void { |
|
481 | + $setDatabaseValue = function(bool $enabled): void { |
|
482 | 482 | $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false'); |
483 | 483 | $this->enabled = $enabled; |
484 | 484 | }; |
485 | 485 | if ($this->backend instanceof IProvideEnabledStateBackend) { |
486 | - $queryDatabaseValue = function (): bool { |
|
486 | + $queryDatabaseValue = function(): bool { |
|
487 | 487 | if ($this->enabled === null) { |
488 | 488 | $enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true'); |
489 | 489 | $this->enabled = $enabled === 'true'; |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | return $quota; |
559 | 559 | } |
560 | 560 | |
561 | - public function getQuotaBytes(): int|float { |
|
561 | + public function getQuotaBytes(): int | float { |
|
562 | 562 | $quota = $this->getQuota(); |
563 | 563 | if ($quota === 'none') { |
564 | 564 | return \OCP\Files\FileInfo::SPACE_UNLIMITED; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | if ($quota !== 'none' and $quota !== 'default') { |
585 | 585 | $bytesQuota = \OCP\Util::computerFileSize($quota); |
586 | 586 | if ($bytesQuota === false) { |
587 | - throw new InvalidArgumentException('Failed to set quota to invalid value ' . $quota); |
|
587 | + throw new InvalidArgumentException('Failed to set quota to invalid value '.$quota); |
|
588 | 588 | } |
589 | 589 | $quota = \OCP\Util::humanFileSize($bytesQuota); |
590 | 590 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $this->config->setUserValue($this->uid, 'files', 'quota', $quota); |
593 | 593 | $this->triggerChange('quota', $quota, $oldQuota); |
594 | 594 | } |
595 | - \OC_Helper::clearStorageInfo('/' . $this->uid . '/files'); |
|
595 | + \OC_Helper::clearStorageInfo('/'.$this->uid.'/files'); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | public function getManagerUids(): array { |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $server = substr($server, 0, -10); |
652 | 652 | } |
653 | 653 | $server = $this->removeProtocolFromUrl($server); |
654 | - return $uid . '@' . $server; |
|
654 | + return $uid.'@'.$server; |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | private function removeProtocolFromUrl(string $url): string { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | OC_App::loadApps(['filesystem']); |
108 | 108 | $prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false); |
109 | 109 | |
110 | - Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
110 | + Filesystem::addStorageWrapper('mount_options', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
111 | 111 | if ($storage->instanceOfStorage(Common::class)) { |
112 | 112 | $options = array_merge($mount->getOptions(), ['mount_point' => $mountPoint]); |
113 | 113 | $storage->setMountOptions($options); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $sharingEnabledForUser = $user ? !$this->shareDisableChecker->sharingDisabledForUser($user->getUID()) : true; |
121 | 121 | Filesystem::addStorageWrapper( |
122 | 122 | 'sharing_mask', |
123 | - function ($mountPoint, IStorage $storage, IMountPoint $mount) use ($reSharingEnabled, $sharingEnabledForUser) { |
|
123 | + function($mountPoint, IStorage $storage, IMountPoint $mount) use ($reSharingEnabled, $sharingEnabledForUser) { |
|
124 | 124 | $sharingEnabledForMount = $mount->getOption('enable_sharing', true); |
125 | 125 | $isShared = $mount instanceof ISharedMountPoint; |
126 | 126 | if (!$sharingEnabledForMount || !$sharingEnabledForUser || (!$reSharingEnabled && $isShared)) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ); |
135 | 135 | |
136 | 136 | // install storage availability wrapper, before most other wrappers |
137 | - Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
137 | + Filesystem::addStorageWrapper('oc_availability', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
138 | 138 | $externalMount = $mount instanceof ExternalMountPoint || $mount instanceof Mount; |
139 | 139 | if ($externalMount && !$storage->isLocal()) { |
140 | 140 | return new Availability(['storage' => $storage]); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | return $storage; |
143 | 143 | }); |
144 | 144 | |
145 | - Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
145 | + Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
146 | 146 | if ($mount->getOption('encoding_compatibility', false) && !$mount instanceof SharedMount) { |
147 | 147 | return new Encoding(['storage' => $storage]); |
148 | 148 | } |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | }); |
151 | 151 | |
152 | 152 | $quotaIncludeExternal = $this->config->getSystemValue('quota_include_external_storage', false); |
153 | - Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage, IMountPoint $mount) use ($quotaIncludeExternal) { |
|
153 | + Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage, IMountPoint $mount) use ($quotaIncludeExternal) { |
|
154 | 154 | // set up quota for home storages, even for other users |
155 | 155 | // which can happen when using sharing |
156 | 156 | if ($mount instanceof HomeMountPoint) { |
157 | 157 | $user = $mount->getUser(); |
158 | - return new Quota(['storage' => $storage, 'quotaCallback' => function () use ($user) { |
|
158 | + return new Quota(['storage' => $storage, 'quotaCallback' => function() use ($user) { |
|
159 | 159 | return $user->getQuotaBytes(); |
160 | 160 | }, 'root' => 'files', 'include_external_storage' => $quotaIncludeExternal]); |
161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return $storage; |
164 | 164 | }); |
165 | 165 | |
166 | - Filesystem::addStorageWrapper('readonly', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
166 | + Filesystem::addStorageWrapper('readonly', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
167 | 167 | /* |
168 | 168 | * Do not allow any operations that modify the storage |
169 | 169 | */ |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | |
201 | 201 | $previouslySetupProviders = $this->setupUserMountProviders[$user->getUID()]; |
202 | 202 | |
203 | - $this->setupForUserWith($user, function () use ($user) { |
|
204 | - $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function ( |
|
203 | + $this->setupForUserWith($user, function() use ($user) { |
|
204 | + $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function( |
|
205 | 205 | IMountProvider $provider, |
206 | 206 | ) use ($user) { |
207 | 207 | return !in_array(get_class($provider), $this->setupUserMountProviders[$user->getUID()]); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | Filesystem::logWarningWhenAddingStorageWrapper($prevLogging); |
238 | 238 | |
239 | - $userDir = '/' . $user->getUID() . '/files'; |
|
239 | + $userDir = '/'.$user->getUID().'/files'; |
|
240 | 240 | |
241 | 241 | Filesystem::initInternal($userDir); |
242 | 242 | |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | } else { |
257 | 257 | $this->mountManager->addMount(new MountPoint( |
258 | 258 | new NullStorage([]), |
259 | - '/' . $user->getUID() |
|
259 | + '/'.$user->getUID() |
|
260 | 260 | )); |
261 | 261 | $this->mountManager->addMount(new MountPoint( |
262 | 262 | new NullStorage([]), |
263 | - '/' . $user->getUID() . '/files' |
|
263 | + '/'.$user->getUID().'/files' |
|
264 | 264 | )); |
265 | 265 | $this->setupUsersComplete[] = $user->getUID(); |
266 | 266 | } |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private function afterUserFullySetup(IUser $user, array $previouslySetupProviders): void { |
277 | 277 | $this->eventLogger->start('fs:setup:user:full:post', 'Housekeeping after user is setup'); |
278 | - $userRoot = '/' . $user->getUID() . '/'; |
|
278 | + $userRoot = '/'.$user->getUID().'/'; |
|
279 | 279 | $mounts = $this->mountManager->getAll(); |
280 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot) { |
|
280 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($userRoot) { |
|
281 | 281 | return str_starts_with($mount->getMountPoint(), $userRoot); |
282 | 282 | }); |
283 | - $allProviders = array_map(function (IMountProvider|IHomeMountProvider|IRootMountProvider $provider) { |
|
283 | + $allProviders = array_map(function(IMountProvider | IHomeMountProvider | IRootMountProvider $provider) { |
|
284 | 284 | return get_class($provider); |
285 | 285 | }, array_merge( |
286 | 286 | $this->mountProviderCollection->getProviders(), |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $this->mountProviderCollection->getRootProviders(), |
289 | 289 | )); |
290 | 290 | $newProviders = array_diff($allProviders, $previouslySetupProviders); |
291 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($previouslySetupProviders) { |
|
291 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($previouslySetupProviders) { |
|
292 | 292 | return !in_array($mount->getMountProvider(), $previouslySetupProviders); |
293 | 293 | }); |
294 | 294 | $this->userMountCache->registerMounts($user, $mounts, $newProviders); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user->getUID()]); |
319 | 319 | $this->eventLogger->end('fs:setup:user:post-init-mountpoint'); |
320 | 320 | |
321 | - $userDir = '/' . $user->getUID() . '/files'; |
|
321 | + $userDir = '/'.$user->getUID().'/files'; |
|
322 | 322 | $this->eventLogger->start('fs:setup:user:setup-hook', 'setup legacy hook'); |
323 | 323 | OC_Hook::emit('OC_Filesystem', 'setup', ['user' => $user->getUID(), 'user_dir' => $userDir]); |
324 | 324 | $this->eventLogger->end('fs:setup:user:setup-hook'); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | } else { |
363 | 363 | return null; |
364 | 364 | } |
365 | - } elseif (str_starts_with($path, '/appdata_' . \OC_Util::getInstanceId()) || str_starts_with($path, '/files_external/')) { |
|
365 | + } elseif (str_starts_with($path, '/appdata_'.\OC_Util::getInstanceId()) || str_starts_with($path, '/files_external/')) { |
|
366 | 366 | return null; |
367 | 367 | } else { |
368 | 368 | [, $userId] = explode('/', $path); |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | // for the user's home folder, and includes children we need everything always |
394 | - if (rtrim($path) === '/' . $user->getUID() . '/files' && $includeChildren) { |
|
394 | + if (rtrim($path) === '/'.$user->getUID().'/files' && $includeChildren) { |
|
395 | 395 | $this->setupForUser($user); |
396 | 396 | return; |
397 | 397 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $setupProviders[] = $cachedMount->getMountProvider(); |
422 | 422 | $mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]); |
423 | 423 | } else { |
424 | - $this->logger->debug('mount at ' . $cachedMount->getMountPoint() . ' has no provider set, performing full setup'); |
|
424 | + $this->logger->debug('mount at '.$cachedMount->getMountPoint().' has no provider set, performing full setup'); |
|
425 | 425 | $this->eventLogger->end('fs:setup:user:path:find'); |
426 | 426 | $this->setupForUser($user); |
427 | 427 | $this->eventLogger->end('fs:setup:user:path'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $subCachedMounts = $this->userMountCache->getMountsInPath($user, $path); |
434 | 434 | $this->eventLogger->end('fs:setup:user:path:find'); |
435 | 435 | |
436 | - $needsFullSetup = array_reduce($subCachedMounts, function (bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) { |
|
436 | + $needsFullSetup = array_reduce($subCachedMounts, function(bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) { |
|
437 | 437 | return $needsFullSetup || $cachedMountInfo->getMountProvider() === ''; |
438 | 438 | }, false); |
439 | 439 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | |
458 | 458 | if (count($mounts)) { |
459 | 459 | $this->userMountCache->registerMounts($user, $mounts, $currentProviders); |
460 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
460 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
461 | 461 | array_walk($mounts, [$this->mountManager, 'addMount']); |
462 | 462 | }); |
463 | 463 | } elseif (!$this->isSetupStarted($user)) { |
@@ -500,12 +500,12 @@ discard block |
||
500 | 500 | return; |
501 | 501 | } |
502 | 502 | |
503 | - $this->eventLogger->start('fs:setup:user:providers', 'Setup filesystem for ' . implode(', ', $providers)); |
|
503 | + $this->eventLogger->start('fs:setup:user:providers', 'Setup filesystem for '.implode(', ', $providers)); |
|
504 | 504 | |
505 | 505 | $this->oneTimeUserSetup($user); |
506 | 506 | |
507 | 507 | // home providers are always used |
508 | - $providers = array_filter($providers, function (string $provider) { |
|
508 | + $providers = array_filter($providers, function(string $provider) { |
|
509 | 509 | return !is_subclass_of($provider, IHomeMountProvider::class); |
510 | 510 | }); |
511 | 511 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } |
529 | 529 | |
530 | 530 | $this->userMountCache->registerMounts($user, $mounts, $providers); |
531 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
531 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
532 | 532 | array_walk($mounts, [$this->mountManager, 'addMount']); |
533 | 533 | }); |
534 | 534 | $this->eventLogger->end('fs:setup:user:providers'); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | private function listenForNewMountProviders() { |
551 | 551 | if (!$this->listeningForProviders) { |
552 | 552 | $this->listeningForProviders = true; |
553 | - $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function ( |
|
553 | + $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function( |
|
554 | 554 | IMountProvider $provider, |
555 | 555 | ) { |
556 | 556 | foreach ($this->setupUsers as $userId) { |
@@ -568,16 +568,16 @@ discard block |
||
568 | 568 | // note that this event handling is intentionally pessimistic |
569 | 569 | // clearing the cache to often is better than not enough |
570 | 570 | |
571 | - $this->eventDispatcher->addListener(UserAddedEvent::class, function (UserAddedEvent $event) { |
|
571 | + $this->eventDispatcher->addListener(UserAddedEvent::class, function(UserAddedEvent $event) { |
|
572 | 572 | $this->cache->remove($event->getUser()->getUID()); |
573 | 573 | }); |
574 | - $this->eventDispatcher->addListener(UserRemovedEvent::class, function (UserRemovedEvent $event) { |
|
574 | + $this->eventDispatcher->addListener(UserRemovedEvent::class, function(UserRemovedEvent $event) { |
|
575 | 575 | $this->cache->remove($event->getUser()->getUID()); |
576 | 576 | }); |
577 | - $this->eventDispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) { |
|
577 | + $this->eventDispatcher->addListener(ShareCreatedEvent::class, function(ShareCreatedEvent $event) { |
|
578 | 578 | $this->cache->remove($event->getShare()->getSharedWith()); |
579 | 579 | }); |
580 | - $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function (InvalidateMountCacheEvent $event, |
|
580 | + $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function(InvalidateMountCacheEvent $event, |
|
581 | 581 | ) { |
582 | 582 | if ($user = $event->getUser()) { |
583 | 583 | $this->cache->remove($user->getUID()); |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | ]; |
595 | 595 | |
596 | 596 | foreach ($genericEvents as $genericEvent) { |
597 | - $this->eventDispatcher->addListener($genericEvent, function ($event) { |
|
597 | + $this->eventDispatcher->addListener($genericEvent, function($event) { |
|
598 | 598 | $this->cache->clear(); |
599 | 599 | }); |
600 | 600 | } |