aboutsummaryrefslogtreecommitdiffstats
path: root/apps/updatenotification/lib/Notification/BackgroundJob.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/updatenotification/lib/Notification/BackgroundJob.php')
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php58
1 files changed, 11 insertions, 47 deletions
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index f8f1f41e589..4889c931238 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -31,7 +31,6 @@ use OC\Updater\VersionCheck;
use OCP\App\IAppManager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
-use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
@@ -40,44 +39,21 @@ use OCP\Notification\IManager;
class BackgroundJob extends TimedJob {
protected $connectionNotifications = [3, 7, 14, 30];
- /** @var IConfig */
- protected $config;
-
- /** @var IManager */
- protected $notificationManager;
-
- /** @var IGroupManager */
- protected $groupManager;
-
- /** @var IAppManager */
- protected $appManager;
-
- /** @var IClientService */
- protected $client;
-
- /** @var Installer */
- protected $installer;
-
/** @var string[] */
protected $users;
- public function __construct(ITimeFactory $timeFactory,
- IConfig $config,
- IManager $notificationManager,
- IGroupManager $groupManager,
- IAppManager $appManager,
- IClientService $client,
- Installer $installer) {
+ public function __construct(
+ ITimeFactory $timeFactory,
+ protected IConfig $config,
+ protected IManager $notificationManager,
+ protected IGroupManager $groupManager,
+ protected IAppManager $appManager,
+ protected Installer $installer,
+ protected VersionCheck $versionCheck,
+ ) {
parent::__construct($timeFactory);
// Run once a day
$this->setInterval(60 * 60 * 24);
-
- $this->config = $config;
- $this->notificationManager = $notificationManager;
- $this->groupManager = $groupManager;
- $this->appManager = $appManager;
- $this->client = $client;
- $this->installer = $installer;
}
protected function run($argument) {
@@ -104,12 +80,10 @@ class BackgroundJob extends TimedJob {
return;
}
- $updater = $this->createVersionCheck();
-
- $status = $updater->check();
+ $status = $this->versionCheck->check();
if ($status === false) {
$errors = 1 + (int) $this->config->getAppValue('updatenotification', 'update_check_errors', '0');
- $this->config->setAppValue('updatenotification', 'update_check_errors', (string)$errors);
+ $this->config->setAppValue('updatenotification', 'update_check_errors', (string) $errors);
if (\in_array($errors, $this->connectionNotifications, true)) {
$this->sendErrorNotifications($errors);
@@ -259,16 +233,6 @@ class BackgroundJob extends TimedJob {
}
/**
- * @return VersionCheck
- */
- protected function createVersionCheck(): VersionCheck {
- return new VersionCheck(
- $this->client,
- $this->config
- );
- }
-
- /**
* @return string
*/
protected function getChannel(): string {