diff options
Diffstat (limited to 'apps/lookup_server_connector/lib')
-rw-r--r-- | apps/lookup_server_connector/lib/AppInfo/Application.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/lookup_server_connector/lib/AppInfo/Application.php b/apps/lookup_server_connector/lib/AppInfo/Application.php index c2bb61000c1..df5ddcbab87 100644 --- a/apps/lookup_server_connector/lib/AppInfo/Application.php +++ b/apps/lookup_server_connector/lib/AppInfo/Application.php @@ -28,12 +28,15 @@ declare(strict_types=1); namespace OCA\LookupServerConnector\AppInfo; +use Closure; use OCA\LookupServerConnector\UpdateLookupServer; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IUser; +use Psr\Container\ContainerInterface; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App implements IBootstrap { @@ -47,16 +50,20 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - /* - * @todo move the OCP events and then move the registration to `register` - */ - $dispatcher = $context->getServerContainer()->getEventDispatcher(); - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($context) { + $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); + } + + /** + * @todo move the OCP events and then move the registration to `register` + */ + private function registerEventListeners(IEventDispatcher $dispatcher, + ContainerInterface $container): void { + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) { /** @var IUser $user */ $user = $event->getSubject(); /** @var UpdateLookupServer $updateLookupServer */ - $updateLookupServer = $context->getServerContainer()->query(UpdateLookupServer::class); + $updateLookupServer = $container->get(UpdateLookupServer::class); $updateLookupServer->userUpdated($user); }); } |