diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2020-09-20 22:03:05 +0200 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2020-09-25 19:18:04 +0200 |
commit | 60ab4941cc7e6ede095e9e4aee3c2bf9a5c3bff6 (patch) | |
tree | baf0b07dd1c545efeb59437af46a99f4d9f69425 /lib/Cron | |
parent | 2c8b4fa019749113658b9ed8cae211b679e4cbc0 (diff) |
Move to nextcloud config and update phpunit
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'lib/Cron')
-rw-r--r-- | lib/Cron/Updater.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/Cron/Updater.php b/lib/Cron/Updater.php index a33d7e7c1..3d9336df7 100644 --- a/lib/Cron/Updater.php +++ b/lib/Cron/Updater.php @@ -13,15 +13,16 @@ namespace OCA\News\Cron; use OC\BackgroundJob\TimedJob; -use OCA\News\Config\Config; +use OCA\News\AppInfo\Application; use OCA\News\Service\StatusService; use OCA\News\Utility\Updater as UpdaterService; +use OCP\IConfig; class Updater extends TimedJob { /** - * @var Config + * @var IConfig */ private $config; /** @@ -34,7 +35,7 @@ class Updater extends TimedJob private $updaterService; public function __construct( - Config $config, + IConfig $config, StatusService $status, UpdaterService $updaterService ) { @@ -42,14 +43,24 @@ class Updater extends TimedJob $this->status = $status; $this->updaterService = $updaterService; - parent::setInterval($this->config->getUpdateInterval()); + $interval = $this->config->getAppValue( + Application::NAME, + 'updateInterval', + Application::DEFAULT_SETTINGS['updateInterval'] + ); + + parent::setInterval($interval); } protected function run($argument) { - if ($this->config->getUseCronUpdates() - && $this->status->isProperlyConfigured() - ) { + $uses_cron = $this->config->getAppValue( + Application::NAME, + 'useCronUpdates', + Application::DEFAULT_SETTINGS['useCronUpdates'] + ); + + if ($uses_cron && $this->status->isProperlyConfigured()) { $this->updaterService->beforeUpdate(); $this->updaterService->update(); $this->updaterService->afterUpdate(); |