@@ -291,10 +291,10 @@ discard block |
||
| 291 | 291 | $this->registerParameter('isCLI', \OC::$CLI); |
| 292 | 292 | $this->registerParameter('serverRoot', \OC::$SERVERROOT); |
| 293 | 293 | |
| 294 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
| 294 | + $this->registerService(ContainerInterface::class, function(ContainerInterface $c) { |
|
| 295 | 295 | return $c; |
| 296 | 296 | }); |
| 297 | - $this->registerService(\OCP\IServerContainer::class, function (ContainerInterface $c) { |
|
| 297 | + $this->registerService(\OCP\IServerContainer::class, function(ContainerInterface $c) { |
|
| 298 | 298 | return $c; |
| 299 | 299 | }); |
| 300 | 300 | |
@@ -319,11 +319,11 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
| 321 | 321 | |
| 322 | - $this->registerService(View::class, function (Server $c) { |
|
| 322 | + $this->registerService(View::class, function(Server $c) { |
|
| 323 | 323 | return new View(); |
| 324 | 324 | }, false); |
| 325 | 325 | |
| 326 | - $this->registerService(IPreview::class, function (ContainerInterface $c) { |
|
| 326 | + $this->registerService(IPreview::class, function(ContainerInterface $c) { |
|
| 327 | 327 | return new PreviewManager( |
| 328 | 328 | $c->get(\OCP\IConfig::class), |
| 329 | 329 | $c->get(IRootFolder::class), |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | /** @deprecated 19.0.0 */ |
| 344 | 344 | $this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
| 345 | 345 | |
| 346 | - $this->registerService(\OC\Preview\Watcher::class, function (ContainerInterface $c) { |
|
| 346 | + $this->registerService(\OC\Preview\Watcher::class, function(ContainerInterface $c) { |
|
| 347 | 347 | return new \OC\Preview\Watcher( |
| 348 | 348 | new \OC\Preview\Storage\Root( |
| 349 | 349 | $c->get(IRootFolder::class), |
@@ -352,11 +352,11 @@ discard block |
||
| 352 | 352 | ); |
| 353 | 353 | }); |
| 354 | 354 | |
| 355 | - $this->registerService(IProfiler::class, function (Server $c) { |
|
| 355 | + $this->registerService(IProfiler::class, function(Server $c) { |
|
| 356 | 356 | return new Profiler($c->get(SystemConfig::class)); |
| 357 | 357 | }); |
| 358 | 358 | |
| 359 | - $this->registerService(\OCP\Encryption\IManager::class, function (Server $c): Encryption\Manager { |
|
| 359 | + $this->registerService(\OCP\Encryption\IManager::class, function(Server $c): Encryption\Manager { |
|
| 360 | 360 | $view = new View(); |
| 361 | 361 | $util = new Encryption\Util( |
| 362 | 362 | $view, |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | /** @deprecated 21.0.0 */ |
| 380 | 380 | $this->registerDeprecatedAlias('EncryptionFileHelper', IFile::class); |
| 381 | - $this->registerService(IFile::class, function (ContainerInterface $c) { |
|
| 381 | + $this->registerService(IFile::class, function(ContainerInterface $c) { |
|
| 382 | 382 | $util = new Encryption\Util( |
| 383 | 383 | new View(), |
| 384 | 384 | $c->get(IUserManager::class), |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | /** @deprecated 21.0.0 */ |
| 396 | 396 | $this->registerDeprecatedAlias('EncryptionKeyStorage', IStorage::class); |
| 397 | - $this->registerService(IStorage::class, function (ContainerInterface $c) { |
|
| 397 | + $this->registerService(IStorage::class, function(ContainerInterface $c) { |
|
| 398 | 398 | $view = new View(); |
| 399 | 399 | $util = new Encryption\Util( |
| 400 | 400 | $view, |
@@ -417,22 +417,22 @@ discard block |
||
| 417 | 417 | /** @deprecated 19.0.0 */ |
| 418 | 418 | $this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
| 419 | 419 | |
| 420 | - $this->registerService('SystemTagManagerFactory', function (ContainerInterface $c) { |
|
| 420 | + $this->registerService('SystemTagManagerFactory', function(ContainerInterface $c) { |
|
| 421 | 421 | /** @var \OCP\IConfig $config */ |
| 422 | 422 | $config = $c->get(\OCP\IConfig::class); |
| 423 | 423 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
| 424 | 424 | return new $factoryClass($this); |
| 425 | 425 | }); |
| 426 | - $this->registerService(ISystemTagManager::class, function (ContainerInterface $c) { |
|
| 426 | + $this->registerService(ISystemTagManager::class, function(ContainerInterface $c) { |
|
| 427 | 427 | return $c->get('SystemTagManagerFactory')->getManager(); |
| 428 | 428 | }); |
| 429 | 429 | /** @deprecated 19.0.0 */ |
| 430 | 430 | $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
| 431 | 431 | |
| 432 | - $this->registerService(ISystemTagObjectMapper::class, function (ContainerInterface $c) { |
|
| 432 | + $this->registerService(ISystemTagObjectMapper::class, function(ContainerInterface $c) { |
|
| 433 | 433 | return $c->get('SystemTagManagerFactory')->getObjectMapper(); |
| 434 | 434 | }); |
| 435 | - $this->registerService('RootFolder', function (ContainerInterface $c) { |
|
| 435 | + $this->registerService('RootFolder', function(ContainerInterface $c) { |
|
| 436 | 436 | $manager = \OC\Files\Filesystem::getMountManager(null); |
| 437 | 437 | $view = new View(); |
| 438 | 438 | $root = new Root( |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | return $root; |
| 455 | 455 | }); |
| 456 | - $this->registerService(HookConnector::class, function (ContainerInterface $c) { |
|
| 456 | + $this->registerService(HookConnector::class, function(ContainerInterface $c) { |
|
| 457 | 457 | return new HookConnector( |
| 458 | 458 | $c->get(IRootFolder::class), |
| 459 | 459 | new View(), |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | /** @deprecated 19.0.0 */ |
| 466 | 466 | $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
| 467 | 467 | |
| 468 | - $this->registerService(IRootFolder::class, function (ContainerInterface $c) { |
|
| 469 | - return new LazyRoot(function () use ($c) { |
|
| 468 | + $this->registerService(IRootFolder::class, function(ContainerInterface $c) { |
|
| 469 | + return new LazyRoot(function() use ($c) { |
|
| 470 | 470 | return $c->get('RootFolder'); |
| 471 | 471 | }); |
| 472 | 472 | }); |
@@ -477,53 +477,53 @@ discard block |
||
| 477 | 477 | $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
| 478 | 478 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
| 479 | 479 | |
| 480 | - $this->registerService(DisplayNameCache::class, function (ContainerInterface $c) { |
|
| 480 | + $this->registerService(DisplayNameCache::class, function(ContainerInterface $c) { |
|
| 481 | 481 | return $c->get(\OC\User\Manager::class)->getDisplayNameCache(); |
| 482 | 482 | }); |
| 483 | 483 | |
| 484 | - $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { |
|
| 484 | + $this->registerService(\OCP\IGroupManager::class, function(ContainerInterface $c) { |
|
| 485 | 485 | $groupManager = new \OC\Group\Manager( |
| 486 | 486 | $this->get(IUserManager::class), |
| 487 | 487 | $c->get(SymfonyAdapter::class), |
| 488 | 488 | $this->get(LoggerInterface::class), |
| 489 | 489 | $this->get(ICacheFactory::class) |
| 490 | 490 | ); |
| 491 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 491 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
| 492 | 492 | /** @var IEventDispatcher $dispatcher */ |
| 493 | 493 | $dispatcher = $this->get(IEventDispatcher::class); |
| 494 | 494 | $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
| 495 | 495 | }); |
| 496 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
| 496 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $group) { |
|
| 497 | 497 | /** @var IEventDispatcher $dispatcher */ |
| 498 | 498 | $dispatcher = $this->get(IEventDispatcher::class); |
| 499 | 499 | $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
| 500 | 500 | }); |
| 501 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 501 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
| 502 | 502 | /** @var IEventDispatcher $dispatcher */ |
| 503 | 503 | $dispatcher = $this->get(IEventDispatcher::class); |
| 504 | 504 | $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
| 505 | 505 | }); |
| 506 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 506 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
| 507 | 507 | /** @var IEventDispatcher $dispatcher */ |
| 508 | 508 | $dispatcher = $this->get(IEventDispatcher::class); |
| 509 | 509 | $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
| 510 | 510 | }); |
| 511 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 511 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 512 | 512 | /** @var IEventDispatcher $dispatcher */ |
| 513 | 513 | $dispatcher = $this->get(IEventDispatcher::class); |
| 514 | 514 | $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
| 515 | 515 | }); |
| 516 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 516 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 517 | 517 | /** @var IEventDispatcher $dispatcher */ |
| 518 | 518 | $dispatcher = $this->get(IEventDispatcher::class); |
| 519 | 519 | $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
| 520 | 520 | }); |
| 521 | - $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 521 | + $groupManager->listen('\OC\Group', 'preRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 522 | 522 | /** @var IEventDispatcher $dispatcher */ |
| 523 | 523 | $dispatcher = $this->get(IEventDispatcher::class); |
| 524 | 524 | $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
| 525 | 525 | }); |
| 526 | - $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 526 | + $groupManager->listen('\OC\Group', 'postRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 527 | 527 | /** @var IEventDispatcher $dispatcher */ |
| 528 | 528 | $dispatcher = $this->get(IEventDispatcher::class); |
| 529 | 529 | $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | /** @deprecated 19.0.0 */ |
| 534 | 534 | $this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
| 535 | 535 | |
| 536 | - $this->registerService(Store::class, function (ContainerInterface $c) { |
|
| 536 | + $this->registerService(Store::class, function(ContainerInterface $c) { |
|
| 537 | 537 | $session = $c->get(ISession::class); |
| 538 | 538 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
| 539 | 539 | $tokenProvider = $c->get(IProvider::class); |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $this->registerAlias(IStore::class, Store::class); |
| 547 | 547 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
| 548 | 548 | |
| 549 | - $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
| 549 | + $this->registerService(\OC\User\Session::class, function(Server $c) { |
|
| 550 | 550 | $manager = $c->get(IUserManager::class); |
| 551 | 551 | $session = new \OC\Session\Memory(''); |
| 552 | 552 | $timeFactory = new TimeFactory(); |
@@ -572,26 +572,26 @@ discard block |
||
| 572 | 572 | $c->get(IEventDispatcher::class) |
| 573 | 573 | ); |
| 574 | 574 | /** @deprecated 21.0.0 use BeforeUserCreatedEvent event with the IEventDispatcher instead */ |
| 575 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 575 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
| 576 | 576 | \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
| 577 | 577 | }); |
| 578 | 578 | /** @deprecated 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */ |
| 579 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 579 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
| 580 | 580 | /** @var \OC\User\User $user */ |
| 581 | 581 | \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
| 582 | 582 | }); |
| 583 | 583 | /** @deprecated 21.0.0 use BeforeUserDeletedEvent event with the IEventDispatcher instead */ |
| 584 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
| 584 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($legacyDispatcher) { |
|
| 585 | 585 | /** @var \OC\User\User $user */ |
| 586 | 586 | \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
| 587 | 587 | $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
| 588 | 588 | }); |
| 589 | 589 | /** @deprecated 21.0.0 use UserDeletedEvent event with the IEventDispatcher instead */ |
| 590 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 590 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
| 591 | 591 | /** @var \OC\User\User $user */ |
| 592 | 592 | \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
| 593 | 593 | }); |
| 594 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 594 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
| 595 | 595 | /** @var \OC\User\User $user */ |
| 596 | 596 | \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
| 597 | 597 | |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | $dispatcher = $this->get(IEventDispatcher::class); |
| 600 | 600 | $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
| 601 | 601 | }); |
| 602 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 602 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
| 603 | 603 | /** @var \OC\User\User $user */ |
| 604 | 604 | \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
| 605 | 605 | |
@@ -607,14 +607,14 @@ discard block |
||
| 607 | 607 | $dispatcher = $this->get(IEventDispatcher::class); |
| 608 | 608 | $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
| 609 | 609 | }); |
| 610 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 610 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
| 611 | 611 | \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
| 612 | 612 | |
| 613 | 613 | /** @var IEventDispatcher $dispatcher */ |
| 614 | 614 | $dispatcher = $this->get(IEventDispatcher::class); |
| 615 | 615 | $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
| 616 | 616 | }); |
| 617 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $loginName, $password, $isTokenLogin) { |
|
| 617 | + $userSession->listen('\OC\User', 'postLogin', function($user, $loginName, $password, $isTokenLogin) { |
|
| 618 | 618 | /** @var \OC\User\User $user */ |
| 619 | 619 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'loginName' => $loginName, 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
| 620 | 620 | |
@@ -622,12 +622,12 @@ discard block |
||
| 622 | 622 | $dispatcher = $this->get(IEventDispatcher::class); |
| 623 | 623 | $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $loginName, $password, $isTokenLogin)); |
| 624 | 624 | }); |
| 625 | - $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
| 625 | + $userSession->listen('\OC\User', 'preRememberedLogin', function($uid) { |
|
| 626 | 626 | /** @var IEventDispatcher $dispatcher */ |
| 627 | 627 | $dispatcher = $this->get(IEventDispatcher::class); |
| 628 | 628 | $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
| 629 | 629 | }); |
| 630 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 630 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
| 631 | 631 | /** @var \OC\User\User $user */ |
| 632 | 632 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
| 633 | 633 | |
@@ -635,19 +635,19 @@ discard block |
||
| 635 | 635 | $dispatcher = $this->get(IEventDispatcher::class); |
| 636 | 636 | $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
| 637 | 637 | }); |
| 638 | - $userSession->listen('\OC\User', 'logout', function ($user) { |
|
| 638 | + $userSession->listen('\OC\User', 'logout', function($user) { |
|
| 639 | 639 | \OC_Hook::emit('OC_User', 'logout', []); |
| 640 | 640 | |
| 641 | 641 | /** @var IEventDispatcher $dispatcher */ |
| 642 | 642 | $dispatcher = $this->get(IEventDispatcher::class); |
| 643 | 643 | $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
| 644 | 644 | }); |
| 645 | - $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
| 645 | + $userSession->listen('\OC\User', 'postLogout', function($user) { |
|
| 646 | 646 | /** @var IEventDispatcher $dispatcher */ |
| 647 | 647 | $dispatcher = $this->get(IEventDispatcher::class); |
| 648 | 648 | $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
| 649 | 649 | }); |
| 650 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
| 650 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
| 651 | 651 | /** @var \OC\User\User $user */ |
| 652 | 652 | \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
| 653 | 653 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | $this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
| 672 | 672 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
| 673 | 673 | |
| 674 | - $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
| 674 | + $this->registerService(\OC\SystemConfig::class, function($c) use ($config) { |
|
| 675 | 675 | return new \OC\SystemConfig($config); |
| 676 | 676 | }); |
| 677 | 677 | /** @deprecated 19.0.0 */ |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
| 682 | 682 | $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
| 683 | 683 | |
| 684 | - $this->registerService(IFactory::class, function (Server $c) { |
|
| 684 | + $this->registerService(IFactory::class, function(Server $c) { |
|
| 685 | 685 | return new \OC\L10N\Factory( |
| 686 | 686 | $c->get(\OCP\IConfig::class), |
| 687 | 687 | $c->getRequest(), |
@@ -702,13 +702,13 @@ discard block |
||
| 702 | 702 | /** @deprecated 19.0.0 */ |
| 703 | 703 | $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
| 704 | 704 | |
| 705 | - $this->registerService(ICache::class, function ($c) { |
|
| 705 | + $this->registerService(ICache::class, function($c) { |
|
| 706 | 706 | return new Cache\File(); |
| 707 | 707 | }); |
| 708 | 708 | /** @deprecated 19.0.0 */ |
| 709 | 709 | $this->registerDeprecatedAlias('UserCache', ICache::class); |
| 710 | 710 | |
| 711 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 711 | + $this->registerService(Factory::class, function(Server $c) { |
|
| 712 | 712 | $profiler = $c->get(IProfiler::class); |
| 713 | 713 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->get(LoggerInterface::class), |
| 714 | 714 | $profiler, |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | $version = implode(',', $v); |
| 735 | 735 | $instanceId = \OC_Util::getInstanceId(); |
| 736 | 736 | $path = \OC::$SERVERROOT; |
| 737 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
| 737 | + $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
| 738 | 738 | return new \OC\Memcache\Factory($prefix, |
| 739 | 739 | $c->get(LoggerInterface::class), |
| 740 | 740 | $profiler, |
@@ -750,12 +750,12 @@ discard block |
||
| 750 | 750 | $this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
| 751 | 751 | $this->registerAlias(ICacheFactory::class, Factory::class); |
| 752 | 752 | |
| 753 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 753 | + $this->registerService('RedisFactory', function(Server $c) { |
|
| 754 | 754 | $systemConfig = $c->get(SystemConfig::class); |
| 755 | 755 | return new RedisFactory($systemConfig, $c->getEventLogger()); |
| 756 | 756 | }); |
| 757 | 757 | |
| 758 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 758 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
| 759 | 759 | $l10n = $this->get(IFactory::class)->get('lib'); |
| 760 | 760 | return new \OC\Activity\Manager( |
| 761 | 761 | $c->getRequest(), |
@@ -768,14 +768,14 @@ discard block |
||
| 768 | 768 | /** @deprecated 19.0.0 */ |
| 769 | 769 | $this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
| 770 | 770 | |
| 771 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 771 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
| 772 | 772 | return new \OC\Activity\EventMerger( |
| 773 | 773 | $c->getL10N('lib') |
| 774 | 774 | ); |
| 775 | 775 | }); |
| 776 | 776 | $this->registerAlias(IValidator::class, Validator::class); |
| 777 | 777 | |
| 778 | - $this->registerService(AvatarManager::class, function (Server $c) { |
|
| 778 | + $this->registerService(AvatarManager::class, function(Server $c) { |
|
| 779 | 779 | return new AvatarManager( |
| 780 | 780 | $c->get(IUserSession::class), |
| 781 | 781 | $c->get(\OC\User\Manager::class), |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
| 797 | 797 | $this->registerAlias(\OCP\Support\Subscription\IAssertion::class, \OC\Support\Subscription\Assertion::class); |
| 798 | 798 | |
| 799 | - $this->registerService(\OC\Log::class, function (Server $c) { |
|
| 799 | + $this->registerService(\OC\Log::class, function(Server $c) { |
|
| 800 | 800 | $logType = $c->get(AllConfig::class)->getSystemValue('log_type', 'file'); |
| 801 | 801 | $factory = new LogFactory($c, $this->get(SystemConfig::class)); |
| 802 | 802 | $logger = $factory->get($logType); |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | // PSR-3 logger |
| 811 | 811 | $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
| 812 | 812 | |
| 813 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
| 813 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
| 814 | 814 | return new LogFactory($c, $this->get(SystemConfig::class)); |
| 815 | 815 | }); |
| 816 | 816 | |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | /** @deprecated 19.0.0 */ |
| 819 | 819 | $this->registerDeprecatedAlias('JobList', IJobList::class); |
| 820 | 820 | |
| 821 | - $this->registerService(Router::class, function (Server $c) { |
|
| 821 | + $this->registerService(Router::class, function(Server $c) { |
|
| 822 | 822 | $cacheFactory = $c->get(ICacheFactory::class); |
| 823 | 823 | $logger = $c->get(LoggerInterface::class); |
| 824 | 824 | if ($cacheFactory->isLocalCacheAvailable()) { |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | /** @deprecated 19.0.0 */ |
| 837 | 837 | $this->registerDeprecatedAlias('Search', ISearch::class); |
| 838 | 838 | |
| 839 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 839 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
| 840 | 840 | $cacheFactory = $c->get(ICacheFactory::class); |
| 841 | 841 | if ($cacheFactory->isAvailable()) { |
| 842 | 842 | $backend = new \OC\Security\RateLimiting\Backend\MemoryCacheBackend( |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
| 873 | 873 | |
| 874 | 874 | $this->registerAlias(IDBConnection::class, ConnectionAdapter::class); |
| 875 | - $this->registerService(Connection::class, function (Server $c) { |
|
| 875 | + $this->registerService(Connection::class, function(Server $c) { |
|
| 876 | 876 | $systemConfig = $c->get(SystemConfig::class); |
| 877 | 877 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
| 878 | 878 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -888,19 +888,19 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | $this->registerAlias(ICertificateManager::class, CertificateManager::class); |
| 890 | 890 | $this->registerAlias(IClientService::class, ClientService::class); |
| 891 | - $this->registerService(NegativeDnsCache::class, function (ContainerInterface $c) { |
|
| 891 | + $this->registerService(NegativeDnsCache::class, function(ContainerInterface $c) { |
|
| 892 | 892 | return new NegativeDnsCache( |
| 893 | 893 | $c->get(ICacheFactory::class), |
| 894 | 894 | ); |
| 895 | 895 | }); |
| 896 | 896 | $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
| 897 | - $this->registerService(IEventLogger::class, function (ContainerInterface $c) { |
|
| 897 | + $this->registerService(IEventLogger::class, function(ContainerInterface $c) { |
|
| 898 | 898 | return new EventLogger($c->get(SystemConfig::class), $c->get(LoggerInterface::class), $c->get(Log::class)); |
| 899 | 899 | }); |
| 900 | 900 | /** @deprecated 19.0.0 */ |
| 901 | 901 | $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
| 902 | 902 | |
| 903 | - $this->registerService(IQueryLogger::class, function (ContainerInterface $c) { |
|
| 903 | + $this->registerService(IQueryLogger::class, function(ContainerInterface $c) { |
|
| 904 | 904 | $queryLogger = new QueryLogger(); |
| 905 | 905 | if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
| 906 | 906 | // In debug mode, module is being activated by default |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | $this->registerDeprecatedAlias('TempManager', TempManager::class); |
| 916 | 916 | $this->registerAlias(ITempManager::class, TempManager::class); |
| 917 | 917 | |
| 918 | - $this->registerService(AppManager::class, function (ContainerInterface $c) { |
|
| 918 | + $this->registerService(AppManager::class, function(ContainerInterface $c) { |
|
| 919 | 919 | // TODO: use auto-wiring |
| 920 | 920 | return new \OC\App\AppManager( |
| 921 | 921 | $c->get(IUserSession::class), |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | /** @deprecated 19.0.0 */ |
| 936 | 936 | $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
| 937 | 937 | |
| 938 | - $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
| 938 | + $this->registerService(IDateTimeFormatter::class, function(Server $c) { |
|
| 939 | 939 | $language = $c->get(\OCP\IConfig::class)->getUserValue($c->get(ISession::class)->get('user_id'), 'core', 'lang', null); |
| 940 | 940 | |
| 941 | 941 | return new DateTimeFormatter( |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | /** @deprecated 19.0.0 */ |
| 947 | 947 | $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
| 948 | 948 | |
| 949 | - $this->registerService(IUserMountCache::class, function (ContainerInterface $c) { |
|
| 949 | + $this->registerService(IUserMountCache::class, function(ContainerInterface $c) { |
|
| 950 | 950 | $mountCache = $c->get(UserMountCache::class); |
| 951 | 951 | $listener = new UserMountCacheListener($mountCache); |
| 952 | 952 | $listener->listen($c->get(IUserManager::class)); |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | /** @deprecated 19.0.0 */ |
| 956 | 956 | $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
| 957 | 957 | |
| 958 | - $this->registerService(IMountProviderCollection::class, function (ContainerInterface $c) { |
|
| 958 | + $this->registerService(IMountProviderCollection::class, function(ContainerInterface $c) { |
|
| 959 | 959 | $loader = $c->get(IStorageFactory::class); |
| 960 | 960 | $mountCache = $c->get(IUserMountCache::class); |
| 961 | 961 | $eventLogger = $c->get(IEventLogger::class); |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | |
| 979 | 979 | /** @deprecated 20.0.0 */ |
| 980 | 980 | $this->registerDeprecatedAlias('IniWrapper', IniGetWrapper::class); |
| 981 | - $this->registerService(IBus::class, function (ContainerInterface $c) { |
|
| 981 | + $this->registerService(IBus::class, function(ContainerInterface $c) { |
|
| 982 | 982 | $busClass = $c->get(\OCP\IConfig::class)->getSystemValue('commandbus'); |
| 983 | 983 | if ($busClass) { |
| 984 | 984 | [$app, $class] = explode('::', $busClass, 2); |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | /** @deprecated 19.0.0 */ |
| 1001 | 1001 | $this->registerDeprecatedAlias('Throttler', Throttler::class); |
| 1002 | 1002 | $this->registerAlias(IThrottler::class, Throttler::class); |
| 1003 | - $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) { |
|
| 1003 | + $this->registerService('IntegrityCodeChecker', function(ContainerInterface $c) { |
|
| 1004 | 1004 | // IConfig and IAppManager requires a working database. This code |
| 1005 | 1005 | // might however be called when ownCloud is not yet setup. |
| 1006 | 1006 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | $c->get(IMimeTypeDetector::class) |
| 1022 | 1022 | ); |
| 1023 | 1023 | }); |
| 1024 | - $this->registerService(\OCP\IRequest::class, function (ContainerInterface $c) { |
|
| 1024 | + $this->registerService(\OCP\IRequest::class, function(ContainerInterface $c) { |
|
| 1025 | 1025 | if (isset($this['urlParams'])) { |
| 1026 | 1026 | $urlParams = $this['urlParams']; |
| 1027 | 1027 | } else { |
@@ -1058,14 +1058,14 @@ discard block |
||
| 1058 | 1058 | /** @deprecated 19.0.0 */ |
| 1059 | 1059 | $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
| 1060 | 1060 | |
| 1061 | - $this->registerService(IRequestId::class, function (ContainerInterface $c): IRequestId { |
|
| 1061 | + $this->registerService(IRequestId::class, function(ContainerInterface $c): IRequestId { |
|
| 1062 | 1062 | return new RequestId( |
| 1063 | 1063 | $_SERVER['UNIQUE_ID'] ?? '', |
| 1064 | 1064 | $this->get(ISecureRandom::class) |
| 1065 | 1065 | ); |
| 1066 | 1066 | }); |
| 1067 | 1067 | |
| 1068 | - $this->registerService(IMailer::class, function (Server $c) { |
|
| 1068 | + $this->registerService(IMailer::class, function(Server $c) { |
|
| 1069 | 1069 | return new Mailer( |
| 1070 | 1070 | $c->get(\OCP\IConfig::class), |
| 1071 | 1071 | $c->get(LoggerInterface::class), |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | /** @deprecated 21.0.0 */ |
| 1083 | 1083 | $this->registerDeprecatedAlias('LDAPProvider', ILDAPProvider::class); |
| 1084 | 1084 | |
| 1085 | - $this->registerService(ILDAPProviderFactory::class, function (ContainerInterface $c) { |
|
| 1085 | + $this->registerService(ILDAPProviderFactory::class, function(ContainerInterface $c) { |
|
| 1086 | 1086 | $config = $c->get(\OCP\IConfig::class); |
| 1087 | 1087 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
| 1088 | 1088 | if (is_null($factoryClass) || !class_exists($factoryClass)) { |
@@ -1091,11 +1091,11 @@ discard block |
||
| 1091 | 1091 | /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
| 1092 | 1092 | return new $factoryClass($this); |
| 1093 | 1093 | }); |
| 1094 | - $this->registerService(ILDAPProvider::class, function (ContainerInterface $c) { |
|
| 1094 | + $this->registerService(ILDAPProvider::class, function(ContainerInterface $c) { |
|
| 1095 | 1095 | $factory = $c->get(ILDAPProviderFactory::class); |
| 1096 | 1096 | return $factory->getLDAPProvider(); |
| 1097 | 1097 | }); |
| 1098 | - $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
|
| 1098 | + $this->registerService(ILockingProvider::class, function(ContainerInterface $c) { |
|
| 1099 | 1099 | $ini = $c->get(IniGetWrapper::class); |
| 1100 | 1100 | $config = $c->get(\OCP\IConfig::class); |
| 1101 | 1101 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -1118,12 +1118,12 @@ discard block |
||
| 1118 | 1118 | /** @deprecated 19.0.0 */ |
| 1119 | 1119 | $this->registerDeprecatedAlias('LockingProvider', ILockingProvider::class); |
| 1120 | 1120 | |
| 1121 | - $this->registerService(ILockManager::class, function (Server $c): LockManager { |
|
| 1121 | + $this->registerService(ILockManager::class, function(Server $c): LockManager { |
|
| 1122 | 1122 | return new LockManager(); |
| 1123 | 1123 | }); |
| 1124 | 1124 | |
| 1125 | 1125 | $this->registerAlias(ILockdownManager::class, 'LockdownManager'); |
| 1126 | - $this->registerService(SetupManager::class, function ($c) { |
|
| 1126 | + $this->registerService(SetupManager::class, function($c) { |
|
| 1127 | 1127 | // create the setupmanager through the mount manager to resolve the cyclic dependency |
| 1128 | 1128 | return $c->get(\OC\Files\Mount\Manager::class)->getSetupManager(); |
| 1129 | 1129 | }); |
@@ -1131,12 +1131,12 @@ discard block |
||
| 1131 | 1131 | /** @deprecated 19.0.0 */ |
| 1132 | 1132 | $this->registerDeprecatedAlias('MountManager', IMountManager::class); |
| 1133 | 1133 | |
| 1134 | - $this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) { |
|
| 1134 | + $this->registerService(IMimeTypeDetector::class, function(ContainerInterface $c) { |
|
| 1135 | 1135 | return new \OC\Files\Type\Detection( |
| 1136 | 1136 | $c->get(IURLGenerator::class), |
| 1137 | 1137 | $c->get(LoggerInterface::class), |
| 1138 | 1138 | \OC::$configDir, |
| 1139 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 1139 | + \OC::$SERVERROOT.'/resources/config/' |
|
| 1140 | 1140 | ); |
| 1141 | 1141 | }); |
| 1142 | 1142 | /** @deprecated 19.0.0 */ |
@@ -1145,22 +1145,22 @@ discard block |
||
| 1145 | 1145 | $this->registerAlias(IMimeTypeLoader::class, Loader::class); |
| 1146 | 1146 | /** @deprecated 19.0.0 */ |
| 1147 | 1147 | $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
| 1148 | - $this->registerService(BundleFetcher::class, function () { |
|
| 1148 | + $this->registerService(BundleFetcher::class, function() { |
|
| 1149 | 1149 | return new BundleFetcher($this->getL10N('lib')); |
| 1150 | 1150 | }); |
| 1151 | 1151 | $this->registerAlias(\OCP\Notification\IManager::class, Manager::class); |
| 1152 | 1152 | /** @deprecated 19.0.0 */ |
| 1153 | 1153 | $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
| 1154 | 1154 | |
| 1155 | - $this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) { |
|
| 1155 | + $this->registerService(CapabilitiesManager::class, function(ContainerInterface $c) { |
|
| 1156 | 1156 | $manager = new CapabilitiesManager($c->get(LoggerInterface::class)); |
| 1157 | - $manager->registerCapability(function () use ($c) { |
|
| 1157 | + $manager->registerCapability(function() use ($c) { |
|
| 1158 | 1158 | return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class)); |
| 1159 | 1159 | }); |
| 1160 | - $manager->registerCapability(function () use ($c) { |
|
| 1160 | + $manager->registerCapability(function() use ($c) { |
|
| 1161 | 1161 | return $c->get(\OC\Security\Bruteforce\Capabilities::class); |
| 1162 | 1162 | }); |
| 1163 | - $manager->registerCapability(function () use ($c) { |
|
| 1163 | + $manager->registerCapability(function() use ($c) { |
|
| 1164 | 1164 | return $c->get(MetadataCapabilities::class); |
| 1165 | 1165 | }); |
| 1166 | 1166 | return $manager; |
@@ -1168,14 +1168,14 @@ discard block |
||
| 1168 | 1168 | /** @deprecated 19.0.0 */ |
| 1169 | 1169 | $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
| 1170 | 1170 | |
| 1171 | - $this->registerService(ICommentsManager::class, function (Server $c) { |
|
| 1171 | + $this->registerService(ICommentsManager::class, function(Server $c) { |
|
| 1172 | 1172 | $config = $c->get(\OCP\IConfig::class); |
| 1173 | 1173 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
| 1174 | 1174 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
| 1175 | 1175 | $factory = new $factoryClass($this); |
| 1176 | 1176 | $manager = $factory->getManager(); |
| 1177 | 1177 | |
| 1178 | - $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
| 1178 | + $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
|
| 1179 | 1179 | $manager = $c->get(IUserManager::class); |
| 1180 | 1180 | $userDisplayName = $manager->getDisplayName($id); |
| 1181 | 1181 | if ($userDisplayName === null) { |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
| 1192 | 1192 | |
| 1193 | 1193 | $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); |
| 1194 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 1194 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
| 1195 | 1195 | /* |
| 1196 | 1196 | * Dark magic for autoloader. |
| 1197 | 1197 | * If we do a class_exists it will try to load the class which will |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | } |
| 1229 | 1229 | return new \OC_Defaults(); |
| 1230 | 1230 | }); |
| 1231 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
| 1231 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
| 1232 | 1232 | return new JSCombiner( |
| 1233 | 1233 | $c->getAppDataDir('js'), |
| 1234 | 1234 | $c->get(IURLGenerator::class), |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
| 1243 | 1243 | $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
| 1244 | 1244 | |
| 1245 | - $this->registerService('CryptoWrapper', function (ContainerInterface $c) { |
|
| 1245 | + $this->registerService('CryptoWrapper', function(ContainerInterface $c) { |
|
| 1246 | 1246 | // FIXME: Instantiated here due to cyclic dependency |
| 1247 | 1247 | $request = new Request( |
| 1248 | 1248 | [ |
@@ -1269,14 +1269,14 @@ discard block |
||
| 1269 | 1269 | }); |
| 1270 | 1270 | /** @deprecated 19.0.0 */ |
| 1271 | 1271 | $this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
| 1272 | - $this->registerService(SessionStorage::class, function (ContainerInterface $c) { |
|
| 1272 | + $this->registerService(SessionStorage::class, function(ContainerInterface $c) { |
|
| 1273 | 1273 | return new SessionStorage($c->get(ISession::class)); |
| 1274 | 1274 | }); |
| 1275 | 1275 | $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
| 1276 | 1276 | /** @deprecated 19.0.0 */ |
| 1277 | 1277 | $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
| 1278 | 1278 | |
| 1279 | - $this->registerService(\OCP\Share\IManager::class, function (IServerContainer $c) { |
|
| 1279 | + $this->registerService(\OCP\Share\IManager::class, function(IServerContainer $c) { |
|
| 1280 | 1280 | $config = $c->get(\OCP\IConfig::class); |
| 1281 | 1281 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
| 1282 | 1282 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | /** @deprecated 19.0.0 */ |
| 1309 | 1309 | $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
| 1310 | 1310 | |
| 1311 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
| 1311 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
| 1312 | 1312 | $instance = new Collaboration\Collaborators\Search($c); |
| 1313 | 1313 | |
| 1314 | 1314 | // register default plugins |
@@ -1333,27 +1333,27 @@ discard block |
||
| 1333 | 1333 | |
| 1334 | 1334 | $this->registerDeprecatedAlias('SettingsManager', \OC\Settings\Manager::class); |
| 1335 | 1335 | $this->registerAlias(\OCP\Settings\IManager::class, \OC\Settings\Manager::class); |
| 1336 | - $this->registerService(\OC\Files\AppData\Factory::class, function (ContainerInterface $c) { |
|
| 1336 | + $this->registerService(\OC\Files\AppData\Factory::class, function(ContainerInterface $c) { |
|
| 1337 | 1337 | return new \OC\Files\AppData\Factory( |
| 1338 | 1338 | $c->get(IRootFolder::class), |
| 1339 | 1339 | $c->get(SystemConfig::class) |
| 1340 | 1340 | ); |
| 1341 | 1341 | }); |
| 1342 | 1342 | |
| 1343 | - $this->registerService('LockdownManager', function (ContainerInterface $c) { |
|
| 1344 | - return new LockdownManager(function () use ($c) { |
|
| 1343 | + $this->registerService('LockdownManager', function(ContainerInterface $c) { |
|
| 1344 | + return new LockdownManager(function() use ($c) { |
|
| 1345 | 1345 | return $c->get(ISession::class); |
| 1346 | 1346 | }); |
| 1347 | 1347 | }); |
| 1348 | 1348 | |
| 1349 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c) { |
|
| 1349 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(ContainerInterface $c) { |
|
| 1350 | 1350 | return new DiscoveryService( |
| 1351 | 1351 | $c->get(ICacheFactory::class), |
| 1352 | 1352 | $c->get(IClientService::class) |
| 1353 | 1353 | ); |
| 1354 | 1354 | }); |
| 1355 | 1355 | |
| 1356 | - $this->registerService(ICloudIdManager::class, function (ContainerInterface $c) { |
|
| 1356 | + $this->registerService(ICloudIdManager::class, function(ContainerInterface $c) { |
|
| 1357 | 1357 | return new CloudIdManager( |
| 1358 | 1358 | $c->get(\OCP\Contacts\IManager::class), |
| 1359 | 1359 | $c->get(IURLGenerator::class), |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | |
| 1366 | 1366 | $this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
| 1367 | 1367 | |
| 1368 | - $this->registerService(ICloudFederationProviderManager::class, function (ContainerInterface $c) { |
|
| 1368 | + $this->registerService(ICloudFederationProviderManager::class, function(ContainerInterface $c) { |
|
| 1369 | 1369 | return new CloudFederationProviderManager( |
| 1370 | 1370 | $c->get(IAppManager::class), |
| 1371 | 1371 | $c->get(IClientService::class), |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | ); |
| 1375 | 1375 | }); |
| 1376 | 1376 | |
| 1377 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
| 1377 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
| 1378 | 1378 | return new CloudFederationFactory(); |
| 1379 | 1379 | }); |
| 1380 | 1380 | |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | /** @deprecated 19.0.0 */ |
| 1387 | 1387 | $this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
| 1388 | 1388 | |
| 1389 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1389 | + $this->registerService(Defaults::class, function(Server $c) { |
|
| 1390 | 1390 | return new Defaults( |
| 1391 | 1391 | $c->getThemingDefaults() |
| 1392 | 1392 | ); |
@@ -1394,17 +1394,17 @@ discard block |
||
| 1394 | 1394 | /** @deprecated 19.0.0 */ |
| 1395 | 1395 | $this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
| 1396 | 1396 | |
| 1397 | - $this->registerService(\OCP\ISession::class, function (ContainerInterface $c) { |
|
| 1397 | + $this->registerService(\OCP\ISession::class, function(ContainerInterface $c) { |
|
| 1398 | 1398 | return $c->get(\OCP\IUserSession::class)->getSession(); |
| 1399 | 1399 | }, false); |
| 1400 | 1400 | |
| 1401 | - $this->registerService(IShareHelper::class, function (ContainerInterface $c) { |
|
| 1401 | + $this->registerService(IShareHelper::class, function(ContainerInterface $c) { |
|
| 1402 | 1402 | return new ShareHelper( |
| 1403 | 1403 | $c->get(\OCP\Share\IManager::class) |
| 1404 | 1404 | ); |
| 1405 | 1405 | }); |
| 1406 | 1406 | |
| 1407 | - $this->registerService(Installer::class, function (ContainerInterface $c) { |
|
| 1407 | + $this->registerService(Installer::class, function(ContainerInterface $c) { |
|
| 1408 | 1408 | return new Installer( |
| 1409 | 1409 | $c->get(AppFetcher::class), |
| 1410 | 1410 | $c->get(IClientService::class), |
@@ -1415,11 +1415,11 @@ discard block |
||
| 1415 | 1415 | ); |
| 1416 | 1416 | }); |
| 1417 | 1417 | |
| 1418 | - $this->registerService(IApiFactory::class, function (ContainerInterface $c) { |
|
| 1418 | + $this->registerService(IApiFactory::class, function(ContainerInterface $c) { |
|
| 1419 | 1419 | return new ApiFactory($c->get(IClientService::class)); |
| 1420 | 1420 | }); |
| 1421 | 1421 | |
| 1422 | - $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) { |
|
| 1422 | + $this->registerService(IInstanceFactory::class, function(ContainerInterface $c) { |
|
| 1423 | 1423 | $memcacheFactory = $c->get(ICacheFactory::class); |
| 1424 | 1424 | return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class)); |
| 1425 | 1425 | }); |
@@ -2357,11 +2357,11 @@ discard block |
||
| 2357 | 2357 | } |
| 2358 | 2358 | |
| 2359 | 2359 | private function registerDeprecatedAlias(string $alias, string $target) { |
| 2360 | - $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias) { |
|
| 2360 | + $this->registerService($alias, function(ContainerInterface $container) use ($target, $alias) { |
|
| 2361 | 2361 | try { |
| 2362 | 2362 | /** @var LoggerInterface $logger */ |
| 2363 | 2363 | $logger = $container->get(LoggerInterface::class); |
| 2364 | - $logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
| 2364 | + $logger->debug('The requested alias "'.$alias.'" is deprecated. Please request "'.$target.'" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
| 2365 | 2365 | } catch (ContainerExceptionInterface $e) { |
| 2366 | 2366 | // Could not get logger. Continue |
| 2367 | 2367 | } |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | OC_App::loadApps(['filesystem']); |
| 133 | 133 | $prevLogging = Filesystem::logWarningWhenAddingStorageWrapper(false); |
| 134 | 134 | |
| 135 | - Filesystem::addStorageWrapper('mount_options', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 135 | + Filesystem::addStorageWrapper('mount_options', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 136 | 136 | if ($storage->instanceOfStorage(Common::class)) { |
| 137 | 137 | $storage->setMountOptions($mount->getOptions()); |
| 138 | 138 | } |
| 139 | 139 | return $storage; |
| 140 | 140 | }); |
| 141 | 141 | |
| 142 | - Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 142 | + Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 143 | 143 | if (!$mount->getOption('enable_sharing', true)) { |
| 144 | 144 | return new PermissionsMask([ |
| 145 | 145 | 'storage' => $storage, |
@@ -150,21 +150,21 @@ discard block |
||
| 150 | 150 | }); |
| 151 | 151 | |
| 152 | 152 | // install storage availability wrapper, before most other wrappers |
| 153 | - Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, IStorage $storage) { |
|
| 153 | + Filesystem::addStorageWrapper('oc_availability', function($mountPoint, IStorage $storage) { |
|
| 154 | 154 | if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) { |
| 155 | 155 | return new Availability(['storage' => $storage]); |
| 156 | 156 | } |
| 157 | 157 | return $storage; |
| 158 | 158 | }); |
| 159 | 159 | |
| 160 | - Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 160 | + Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 161 | 161 | if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { |
| 162 | 162 | return new Encoding(['storage' => $storage]); |
| 163 | 163 | } |
| 164 | 164 | return $storage; |
| 165 | 165 | }); |
| 166 | 166 | |
| 167 | - Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) { |
|
| 167 | + Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) { |
|
| 168 | 168 | // set up quota for home storages, even for other users |
| 169 | 169 | // which can happen when using sharing |
| 170 | 170 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | if ($storage->instanceOfStorage(HomeObjectStoreStorage::class) || $storage->instanceOfStorage(Home::class)) { |
| 175 | 175 | if (is_object($storage->getUser())) { |
| 176 | 176 | $user = $storage->getUser(); |
| 177 | - return new Quota(['storage' => $storage, 'quotaCallback' => function () use ($user) { |
|
| 177 | + return new Quota(['storage' => $storage, 'quotaCallback' => function() use ($user) { |
|
| 178 | 178 | return OC_Util::getUserQuota($user); |
| 179 | 179 | }, 'root' => 'files']); |
| 180 | 180 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | return $storage; |
| 184 | 184 | }); |
| 185 | 185 | |
| 186 | - Filesystem::addStorageWrapper('readonly', function ($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 186 | + Filesystem::addStorageWrapper('readonly', function($mountPoint, IStorage $storage, IMountPoint $mount) { |
|
| 187 | 187 | /* |
| 188 | 188 | * Do not allow any operations that modify the storage |
| 189 | 189 | */ |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | $previouslySetupProviders = $this->setupUserMountProviders[$user->getUID()]; |
| 222 | 222 | |
| 223 | - $this->setupForUserWith($user, function () use ($user) { |
|
| 224 | - $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function ( |
|
| 223 | + $this->setupForUserWith($user, function() use ($user) { |
|
| 224 | + $this->mountProviderCollection->addMountForUser($user, $this->mountManager, function( |
|
| 225 | 225 | IMountProvider $provider |
| 226 | 226 | ) use ($user) { |
| 227 | 227 | return !in_array(get_class($provider), $this->setupUserMountProviders[$user->getUID()]); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | Filesystem::logWarningWhenAddingStorageWrapper($prevLogging); |
| 252 | 252 | |
| 253 | - $userDir = '/' . $user->getUID() . '/files'; |
|
| 253 | + $userDir = '/'.$user->getUID().'/files'; |
|
| 254 | 254 | |
| 255 | 255 | Filesystem::initInternal($userDir); |
| 256 | 256 | |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | } else { |
| 271 | 271 | $this->mountManager->addMount(new MountPoint( |
| 272 | 272 | new NullStorage([]), |
| 273 | - '/' . $user->getUID() |
|
| 273 | + '/'.$user->getUID() |
|
| 274 | 274 | )); |
| 275 | 275 | $this->mountManager->addMount(new MountPoint( |
| 276 | 276 | new NullStorage([]), |
| 277 | - '/' . $user->getUID() . '/files' |
|
| 277 | + '/'.$user->getUID().'/files' |
|
| 278 | 278 | )); |
| 279 | 279 | $this->setupUsersComplete[] = $user->getUID(); |
| 280 | 280 | } |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | private function afterUserFullySetup(IUser $user, array $previouslySetupProviders): void { |
| 291 | 291 | $this->eventLogger->start('fs:setup:user:full:post', 'Housekeeping after user is setup'); |
| 292 | - $userRoot = '/' . $user->getUID() . '/'; |
|
| 292 | + $userRoot = '/'.$user->getUID().'/'; |
|
| 293 | 293 | $mounts = $this->mountManager->getAll(); |
| 294 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($userRoot) { |
|
| 294 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($userRoot) { |
|
| 295 | 295 | return strpos($mount->getMountPoint(), $userRoot) === 0; |
| 296 | 296 | }); |
| 297 | - $allProviders = array_map(function (IMountProvider $provider) { |
|
| 297 | + $allProviders = array_map(function(IMountProvider $provider) { |
|
| 298 | 298 | return get_class($provider); |
| 299 | 299 | }, $this->mountProviderCollection->getProviders()); |
| 300 | 300 | $newProviders = array_diff($allProviders, $previouslySetupProviders); |
| 301 | - $mounts = array_filter($mounts, function (IMountPoint $mount) use ($previouslySetupProviders) { |
|
| 301 | + $mounts = array_filter($mounts, function(IMountPoint $mount) use ($previouslySetupProviders) { |
|
| 302 | 302 | return !in_array($mount->getMountProvider(), $previouslySetupProviders); |
| 303 | 303 | }); |
| 304 | 304 | $this->userMountCache->registerMounts($user, $mounts, $newProviders); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user->getUID()]); |
| 333 | 333 | $this->eventLogger->end('fs:setup:user:post-init-mountpoint'); |
| 334 | 334 | |
| 335 | - $userDir = '/' . $user->getUID() . '/files'; |
|
| 335 | + $userDir = '/'.$user->getUID().'/files'; |
|
| 336 | 336 | $this->eventLogger->start('fs:setup:user:setup-hook', 'setup legacy hook'); |
| 337 | 337 | OC_Hook::emit('OC_Filesystem', 'setup', ['user' => $user->getUID(), 'user_dir' => $userDir]); |
| 338 | 338 | $this->eventLogger->end('fs:setup:user:setup-hook'); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | } else { |
| 376 | 376 | return null; |
| 377 | 377 | } |
| 378 | - } elseif (strpos($path, '/appdata_' . \OC_Util::getInstanceId()) === 0 || strpos($path, '/files_external/') === 0) { |
|
| 378 | + } elseif (strpos($path, '/appdata_'.\OC_Util::getInstanceId()) === 0 || strpos($path, '/files_external/') === 0) { |
|
| 379 | 379 | return null; |
| 380 | 380 | } else { |
| 381 | 381 | [, $userId] = explode('/', $path); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | // for the user's home folder, and includes children we need everything always |
| 407 | - if (rtrim($path) === "/" . $user->getUID() . "/files" && $includeChildren) { |
|
| 407 | + if (rtrim($path) === "/".$user->getUID()."/files" && $includeChildren) { |
|
| 408 | 408 | $this->setupForUser($user); |
| 409 | 409 | return; |
| 410 | 410 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $setupProviders[] = $cachedMount->getMountProvider(); |
| 437 | 437 | $mounts = $this->mountProviderCollection->getUserMountsForProviderClasses($user, [$cachedMount->getMountProvider()]); |
| 438 | 438 | } else { |
| 439 | - $this->logger->debug("mount at " . $cachedMount->getMountPoint() . " has no provider set, performing full setup"); |
|
| 439 | + $this->logger->debug("mount at ".$cachedMount->getMountPoint()." has no provider set, performing full setup"); |
|
| 440 | 440 | $this->eventLogger->end('fs:setup:user:path:find'); |
| 441 | 441 | $this->setupForUser($user); |
| 442 | 442 | $this->eventLogger->end('fs:setup:user:path'); |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | $subCachedMounts = $this->userMountCache->getMountsInPath($user, $path); |
| 449 | 449 | $this->eventLogger->end('fs:setup:user:path:find'); |
| 450 | 450 | |
| 451 | - $needsFullSetup = array_reduce($subCachedMounts, function (bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) { |
|
| 451 | + $needsFullSetup = array_reduce($subCachedMounts, function(bool $needsFullSetup, ICachedMountInfo $cachedMountInfo) { |
|
| 452 | 452 | return $needsFullSetup || $cachedMountInfo->getMountProvider() === ''; |
| 453 | 453 | }, false); |
| 454 | 454 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | |
| 473 | 473 | if (count($mounts)) { |
| 474 | 474 | $this->userMountCache->registerMounts($user, $mounts, $currentProviders); |
| 475 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
| 475 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
| 476 | 476 | array_walk($mounts, [$this->mountManager, 'addMount']); |
| 477 | 477 | }); |
| 478 | 478 | } elseif (!$this->isSetupStarted($user)) { |
@@ -511,10 +511,10 @@ discard block |
||
| 511 | 511 | return; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - $this->eventLogger->start('fs:setup:user:providers', "Setup filesystem for " . implode(', ', $providers)); |
|
| 514 | + $this->eventLogger->start('fs:setup:user:providers', "Setup filesystem for ".implode(', ', $providers)); |
|
| 515 | 515 | |
| 516 | 516 | // home providers are always used |
| 517 | - $providers = array_filter($providers, function (string $provider) { |
|
| 517 | + $providers = array_filter($providers, function(string $provider) { |
|
| 518 | 518 | return !is_subclass_of($provider, IHomeMountProvider::class); |
| 519 | 519 | }); |
| 520 | 520 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | $this->userMountCache->registerMounts($user, $mounts, $providers); |
| 540 | - $this->setupForUserWith($user, function () use ($mounts) { |
|
| 540 | + $this->setupForUserWith($user, function() use ($mounts) { |
|
| 541 | 541 | array_walk($mounts, [$this->mountManager, 'addMount']); |
| 542 | 542 | }); |
| 543 | 543 | $this->eventLogger->end('fs:setup:user:providers'); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | private function listenForNewMountProviders() { |
| 560 | 560 | if (!$this->listeningForProviders) { |
| 561 | 561 | $this->listeningForProviders = true; |
| 562 | - $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function ( |
|
| 562 | + $this->mountProviderCollection->listen('\OC\Files\Config', 'registerMountProvider', function( |
|
| 563 | 563 | IMountProvider $provider |
| 564 | 564 | ) { |
| 565 | 565 | foreach ($this->setupUsers as $userId) { |
@@ -577,16 +577,16 @@ discard block |
||
| 577 | 577 | // note that this event handling is intentionally pessimistic |
| 578 | 578 | // clearing the cache to often is better than not enough |
| 579 | 579 | |
| 580 | - $this->eventDispatcher->addListener(UserAddedEvent::class, function (UserAddedEvent $event) { |
|
| 580 | + $this->eventDispatcher->addListener(UserAddedEvent::class, function(UserAddedEvent $event) { |
|
| 581 | 581 | $this->cache->remove($event->getUser()->getUID()); |
| 582 | 582 | }); |
| 583 | - $this->eventDispatcher->addListener(UserRemovedEvent::class, function (UserRemovedEvent $event) { |
|
| 583 | + $this->eventDispatcher->addListener(UserRemovedEvent::class, function(UserRemovedEvent $event) { |
|
| 584 | 584 | $this->cache->remove($event->getUser()->getUID()); |
| 585 | 585 | }); |
| 586 | - $this->eventDispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) { |
|
| 586 | + $this->eventDispatcher->addListener(ShareCreatedEvent::class, function(ShareCreatedEvent $event) { |
|
| 587 | 587 | $this->cache->remove($event->getShare()->getSharedWith()); |
| 588 | 588 | }); |
| 589 | - $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function (InvalidateMountCacheEvent $event |
|
| 589 | + $this->eventDispatcher->addListener(InvalidateMountCacheEvent::class, function(InvalidateMountCacheEvent $event |
|
| 590 | 590 | ) { |
| 591 | 591 | if ($user = $event->getUser()) { |
| 592 | 592 | $this->cache->remove($user->getUID()); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | ]; |
| 604 | 604 | |
| 605 | 605 | foreach ($genericEvents as $genericEvent) { |
| 606 | - $this->eventDispatcher->addListener($genericEvent, function ($event) { |
|
| 606 | + $this->eventDispatcher->addListener($genericEvent, function($event) { |
|
| 607 | 607 | $this->cache->clear(); |
| 608 | 608 | }); |
| 609 | 609 | } |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | public function registerMounts(IUser $user, array $mounts, array $mountProviderClasses = null) { |
| 80 | 80 | $this->eventLogger->start('fs:setup:user:register', 'Registering mounts for user'); |
| 81 | 81 | // filter out non-proper storages coming from unit tests |
| 82 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
| 82 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
| 83 | 83 | return $mount instanceof SharedMount || ($mount->getStorage() && $mount->getStorage()->getCache()); |
| 84 | 84 | }); |
| 85 | 85 | /** @var ICachedMountInfo[] $newMounts */ |
| 86 | - $newMounts = array_map(function (IMountPoint $mount) use ($user) { |
|
| 86 | + $newMounts = array_map(function(IMountPoint $mount) use ($user) { |
|
| 87 | 87 | // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) |
| 88 | 88 | if ($mount->getStorageRootId() === -1) { |
| 89 | 89 | return null; |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | }, $mounts); |
| 94 | 94 | $newMounts = array_values(array_filter($newMounts)); |
| 95 | - $newMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
| 95 | + $newMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
| 96 | 96 | return $mount->getRootId(); |
| 97 | 97 | }, $newMounts); |
| 98 | 98 | $newMounts = array_combine($newMountRootIds, $newMounts); |
| 99 | 99 | |
| 100 | 100 | $cachedMounts = $this->getMountsForUser($user); |
| 101 | 101 | if (is_array($mountProviderClasses)) { |
| 102 | - $cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) { |
|
| 102 | + $cachedMounts = array_filter($cachedMounts, function(ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) { |
|
| 103 | 103 | // for existing mounts that didn't have a mount provider set |
| 104 | 104 | // we still want the ones that map to new mounts |
| 105 | 105 | if ($mountInfo->getMountProvider() === '' && isset($newMounts[$mountInfo->getRootId()])) { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | return in_array($mountInfo->getMountProvider(), $mountProviderClasses); |
| 109 | 109 | }); |
| 110 | 110 | } |
| 111 | - $cachedMountRootIds = array_map(function (ICachedMountInfo $mount) { |
|
| 111 | + $cachedMountRootIds = array_map(function(ICachedMountInfo $mount) { |
|
| 112 | 112 | return $mount->getRootId(); |
| 113 | 113 | }, $cachedMounts); |
| 114 | 114 | $cachedMounts = array_combine($cachedMountRootIds, $cachedMounts); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | ], ['root_id', 'user_id']); |
| 187 | 187 | } else { |
| 188 | 188 | // in some cases this is legitimate, like orphaned shares |
| 189 | - $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); |
|
| 189 | + $this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint()); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | $mount_id = $row['mount_id']; |
| 222 | 222 | if (!is_null($mount_id)) { |
| 223 | - $mount_id = (int)$mount_id; |
|
| 223 | + $mount_id = (int) $mount_id; |
|
| 224 | 224 | } |
| 225 | 225 | return new CachedMountInfo( |
| 226 | 226 | $user, |
| 227 | - (int)$row['storage_id'], |
|
| 228 | - (int)$row['root_id'], |
|
| 227 | + (int) $row['storage_id'], |
|
| 228 | + (int) $row['root_id'], |
|
| 229 | 229 | $row['mount_point'], |
| 230 | 230 | $row['mount_provider_class'] ?? '', |
| 231 | 231 | $mount_id, |
@@ -313,12 +313,12 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | if (is_array($row)) { |
| 315 | 315 | $this->cacheInfoCache[$fileId] = [ |
| 316 | - (int)$row['storage'], |
|
| 317 | - (string)$row['path'], |
|
| 318 | - (int)$row['mimetype'] |
|
| 316 | + (int) $row['storage'], |
|
| 317 | + (string) $row['path'], |
|
| 318 | + (int) $row['mimetype'] |
|
| 319 | 319 | ]; |
| 320 | 320 | } else { |
| 321 | - throw new NotFoundException('File with id "' . $fileId . '" not found'); |
|
| 321 | + throw new NotFoundException('File with id "'.$fileId.'" not found'); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | return $this->cacheInfoCache[$fileId]; |
@@ -350,17 +350,17 @@ discard block |
||
| 350 | 350 | $rows = $result->fetchAll(); |
| 351 | 351 | $result->closeCursor(); |
| 352 | 352 | // filter mounts that are from the same storage but a different directory |
| 353 | - $filteredMounts = array_filter($rows, function (array $row) use ($internalPath, $fileId) { |
|
| 354 | - if ($fileId === (int)$row['root_id']) { |
|
| 353 | + $filteredMounts = array_filter($rows, function(array $row) use ($internalPath, $fileId) { |
|
| 354 | + if ($fileId === (int) $row['root_id']) { |
|
| 355 | 355 | return true; |
| 356 | 356 | } |
| 357 | 357 | $internalMountPath = $row['path'] ?? ''; |
| 358 | 358 | |
| 359 | - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; |
|
| 359 | + return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/'; |
|
| 360 | 360 | }); |
| 361 | 361 | |
| 362 | 362 | $filteredMounts = array_filter(array_map([$this, 'dbRowToMountInfo'], $filteredMounts)); |
| 363 | - return array_map(function (ICachedMountInfo $mount) use ($internalPath) { |
|
| 363 | + return array_map(function(ICachedMountInfo $mount) use ($internalPath) { |
|
| 364 | 364 | return new CachedMountFileInfo( |
| 365 | 365 | $mount->getUser(), |
| 366 | 366 | $mount->getStorageId(), |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $slash |
| 419 | 419 | ); |
| 420 | 420 | |
| 421 | - $userIds = array_map(function (IUser $user) { |
|
| 421 | + $userIds = array_map(function(IUser $user) { |
|
| 422 | 422 | return $user->getUID(); |
| 423 | 423 | }, $users); |
| 424 | 424 | |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | public function getMountForPath(IUser $user, string $path): ICachedMountInfo { |
| 451 | 451 | $mounts = $this->getMountsForUser($user); |
| 452 | - $mountPoints = array_map(function (ICachedMountInfo $mount) { |
|
| 452 | + $mountPoints = array_map(function(ICachedMountInfo $mount) { |
|
| 453 | 453 | return $mount->getMountPoint(); |
| 454 | 454 | }, $mounts); |
| 455 | 455 | $mounts = array_combine($mountPoints, $mounts); |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | // walk up the directory tree until we find a path that has a mountpoint set |
| 459 | 459 | // the loop will return if a mountpoint is found or break if none are found |
| 460 | 460 | while (true) { |
| 461 | - $mountPoint = $current . '/'; |
|
| 461 | + $mountPoint = $current.'/'; |
|
| 462 | 462 | if (isset($mounts[$mountPoint])) { |
| 463 | 463 | return $mounts[$mountPoint]; |
| 464 | 464 | } elseif ($current === '') { |
@@ -471,13 +471,13 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - throw new NotFoundException("No cached mount for path " . $path); |
|
| 474 | + throw new NotFoundException("No cached mount for path ".$path); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | public function getMountsInPath(IUser $user, string $path): array { |
| 478 | - $path = rtrim($path, '/') . '/'; |
|
| 478 | + $path = rtrim($path, '/').'/'; |
|
| 479 | 479 | $mounts = $this->getMountsForUser($user); |
| 480 | - return array_filter($mounts, function (ICachedMountInfo $mount) use ($path) { |
|
| 480 | + return array_filter($mounts, function(ICachedMountInfo $mount) use ($path) { |
|
| 481 | 481 | return $mount->getMountPoint() !== $path && strpos($mount->getMountPoint(), $path) === 0; |
| 482 | 482 | }); |
| 483 | 483 | } |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | private function getMountsFromProvider(IMountProvider $provider, IUser $user, IStorageFactory $loader): array { |
| 86 | 86 | $class = str_replace('\\', '_', get_class($provider)); |
| 87 | 87 | $uid = $user->getUID(); |
| 88 | - $this->eventLogger->start('fs:setup:provider:' . $class, "Getting mounts from $class for $uid"); |
|
| 88 | + $this->eventLogger->start('fs:setup:provider:'.$class, "Getting mounts from $class for $uid"); |
|
| 89 | 89 | $mounts = $provider->getMountsForUser($user, $loader) ?? []; |
| 90 | - $this->eventLogger->end('fs:setup:provider:' . $class); |
|
| 90 | + $this->eventLogger->end('fs:setup:provider:'.$class); |
|
| 91 | 91 | return $mounts; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private function getUserMountsForProviders(IUser $user, array $providers): array { |
| 100 | 100 | $loader = $this->loader; |
| 101 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
| 101 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
| 102 | 102 | return $this->getMountsFromProvider($provider, $user, $loader); |
| 103 | 103 | }, $providers); |
| 104 | - $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
| 104 | + $mounts = array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
| 105 | 105 | return array_merge($mounts, $providerMounts); |
| 106 | 106 | }, []); |
| 107 | 107 | return $this->filterMounts($user, $mounts); |
@@ -128,10 +128,10 @@ discard block |
||
| 128 | 128 | } else { |
| 129 | 129 | $providers = $this->providers; |
| 130 | 130 | } |
| 131 | - $firstProviders = array_filter($providers, function (IMountProvider $provider) { |
|
| 131 | + $firstProviders = array_filter($providers, function(IMountProvider $provider) { |
|
| 132 | 132 | return (get_class($provider) !== 'OCA\Files_Sharing\MountProvider'); |
| 133 | 133 | }); |
| 134 | - $lastProviders = array_filter($providers, function (IMountProvider $provider) { |
|
| 134 | + $lastProviders = array_filter($providers, function(IMountProvider $provider) { |
|
| 135 | 135 | return (get_class($provider) === 'OCA\Files_Sharing\MountProvider'); |
| 136 | 136 | }); |
| 137 | 137 | foreach ($firstProviders as $provider) { |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
| 168 | 168 | foreach ($providers as $homeProvider) { |
| 169 | 169 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
| 170 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
| 170 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
| 171 | 171 | return $mount; |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | - throw new \Exception('No home storage configured for user ' . $user); |
|
| 174 | + throw new \Exception('No home storage configured for user '.$user); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | private function filterMounts(IUser $user, array $mountPoints) { |
| 193 | - return array_filter($mountPoints, function (IMountPoint $mountPoint) use ($user) { |
|
| 193 | + return array_filter($mountPoints, function(IMountPoint $mountPoint) use ($user) { |
|
| 194 | 194 | foreach ($this->mountFilters as $filter) { |
| 195 | 195 | if ($filter($mountPoint, $user) === false) { |
| 196 | 196 | return false; |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function getRootMounts(): array { |
| 234 | 234 | $loader = $this->loader; |
| 235 | - $mounts = array_map(function (IRootMountProvider $provider) use ($loader) { |
|
| 235 | + $mounts = array_map(function(IRootMountProvider $provider) use ($loader) { |
|
| 236 | 236 | return $provider->getRootMounts($loader); |
| 237 | 237 | }, $this->rootProviders); |
| 238 | - $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
| 238 | + $mounts = array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
| 239 | 239 | return array_merge($mounts, $providerMounts); |
| 240 | 240 | }, []); |
| 241 | 241 | return $mounts; |