registerNotifierService(Notifier::class); $context->registerNotifierService(AppUpdateNotifier::class); $context->registerEventListener(AppUpdateEvent::class, AppUpdateEventListener::class); $context->registerEventListener(BeforeTemplateRenderedEvent::class, BeforeTemplateRenderedEventListener::class); } public function boot(IBootContext $context): void { $context->injectFn(function (IConfig $config, IUserSession $userSession, IAppManager $appManager, IGroupManager $groupManager, ContainerInterface $container, LoggerInterface $logger) { if ($config->getSystemValue('updatechecker', true) !== true) { // Updater check is disabled return; } $user = $userSession->getUser(); if (!$user instanceof IUser) { // Nothing to do for guests return; } if (!$appManager->isEnabledForUser('notifications') && $groupManager->isAdmin($user->getUID())) { try { $updateChecker = $container->get(UpdateChecker::class); } catch (ContainerExceptionInterface $e) { $logger->error($e->getMessage(), ['exception' => $e]); return; } if ($updateChecker->getUpdateState() !== []) { Util::addScript('updatenotification', 'legacy-notification'); \OC_Hook::connect('\OCP\Config', 'js', $updateChecker, 'populateJavaScriptVariables'); } } }); } }