diff options
author | Matthias Held <ilovemilk@wusa.io> | 2019-09-30 21:54:56 +0300 |
---|---|---|
committer | Matthias Held <ilovemilk@wusa.io> | 2019-09-30 21:54:56 +0300 |
commit | 51eef892a42e12132813fa670820f63deb5f8b0f (patch) | |
tree | 95c118cdded8be96299f7e684e044d6ba38b47c5 | |
parent | 22a2fd92c041c3ba26f691be2a3de11422649546 (diff) |
update notifier to nextcloud version 17
-rw-r--r-- | .travis.yml | 10 | ||||
-rw-r--r-- | lib/AppInfo/Application.php | 11 | ||||
-rw-r--r-- | lib/Notification/Notifier.php | 20 |
3 files changed, 30 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml index f479b51..d9b08a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: php env: global: - - CORE_BRANCH=stable16 + - CORE_BRANCH=stable17 - APP_NAME=ransomware_detection branches: @@ -50,6 +50,14 @@ jobs: - cd apps/$APP_NAME/ - phpunit --configuration phpunit.xml - stage: test + php: 7.0 + env: + - DB=sqlite + - CORE_BRANCH=stable16 + script: + - cd apps/$APP_NAME/ + - phpunit --configuration phpunit.xml + - stage: test php: 7.1 env: - DB=mysql diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index e3827bf..dedb5af 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -174,15 +174,6 @@ class Application extends App protected function registerNotificationNotifier() { - $this->getContainer()->getServer()->getNotificationManager()->registerNotifier(function () { - return $this->getContainer()->query(Notifier::class); - }, function () { - $l = $this->getContainer()->getServer()->getL10NFactory()->get(self::APP_ID); - - return [ - 'id' => self::APP_ID, - 'name' => $l->t('Ransomware recovery'), - ]; - }); + $this->getContainer()->getServer()->getNotificationManager()->registerNotifierService(Notifier::class); } } diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index b7a19bd..e85cca0 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -96,4 +96,24 @@ class Notifier implements INotifier throw new \InvalidArgumentException('Unknown subject'); } } + + /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return Application::APP_ID; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->l10nFactory->get(Application::APP_ID)->t('Ransomware recovery'); + } } |