diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-07-13 17:09:23 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-07-13 17:09:23 +0200 |
commit | 81a433d5dbfab5204f9cb4c5deeec11ddbc7dda1 (patch) | |
tree | 6404e3ee115bb9be655b153b539d88699b2ec36c /apps/updatenotification/lib | |
parent | 2c87ce60a04eb98533d430ef7abe386ef0d04c2a (diff) | |
download | nextcloud-server-81a433d5dbfab5204f9cb4c5deeec11ddbc7dda1.tar.gz nextcloud-server-81a433d5dbfab5204f9cb4c5deeec11ddbc7dda1.zip |
Use IBootstrap for the app updatenotification
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r-- | apps/updatenotification/lib/AppInfo/Application.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/updatenotification/lib/AppInfo/Application.php b/apps/updatenotification/lib/AppInfo/Application.php index 9a0461d573b..12d5cd9e626 100644 --- a/apps/updatenotification/lib/AppInfo/Application.php +++ b/apps/updatenotification/lib/AppInfo/Application.php @@ -7,6 +7,7 @@ declare(strict_types=1); * * @author Joas Schilling <coding@schilljs.com> * @author Lukas Reschke <lukas@statuscode.ch> + * @author Morris Jobke <hey@morrisjobke.de> * * @license GNU AGPL version 3 or any later version * @@ -30,17 +31,23 @@ namespace OCA\UpdateNotification\AppInfo; use OCA\UpdateNotification\Notification\Notifier; use OCA\UpdateNotification\UpdateChecker; use OCP\AppFramework\App; +use OCP\AppFramework\Bootstrap\IBootContext; +use OCP\AppFramework\Bootstrap\IBootstrap; +use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\AppFramework\QueryException; use OCP\IUser; use OCP\Util; -class Application extends App { +class Application extends App implements IBootstrap { public function __construct() { parent::__construct('updatenotification', []); } - public function register() { - $server = $this->getContainer()->getServer(); + public function register(IRegistrationContext $context): void { + } + + public function boot(IBootContext $context): void { + $server = $context->getServerContainer(); if ($server->getConfig()->getSystemValue('updatechecker', true) !== true) { // Updater check is disabled @@ -48,7 +55,8 @@ class Application extends App { } // Always register the notifier, so background jobs (without a user) can send push notifications - $this->registerNotifier(); + $notificationsManager = $server->getNotificationManager(); + $notificationsManager->registerNotifierService(Notifier::class); $user = $server->getUserSession()->getUser(); if (!$user instanceof IUser) { @@ -59,7 +67,7 @@ class Application extends App { if (!$server->getAppManager()->isEnabledForUser('notifications') && $server->getGroupManager()->isAdmin($user->getUID())) { try { - $updateChecker = $this->getContainer()->query(UpdateChecker::class); + $updateChecker = $server->query(UpdateChecker::class); } catch (QueryException $e) { $server->getLogger()->logException($e); return; @@ -71,9 +79,4 @@ class Application extends App { } } } - - public function registerNotifier() { - $notificationsManager = $this->getContainer()->getServer()->getNotificationManager(); - $notificationsManager->registerNotifierService(Notifier::class); - } } |