diff options
author | Joas Schilling <coding@schilljs.com> | 2020-12-14 16:35:12 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-12-14 16:35:12 +0100 |
commit | 96253c7c1b02c9e3a5506198c179dd7a32d01fbe (patch) | |
tree | 3c35cede81cf3978d1553ff1932c5818a9dd86d4 /apps/federatedfilesharing | |
parent | 39bee7948d44c2f5d6f5465bc9c4c3ffe6b8c34e (diff) | |
download | nextcloud-server-96253c7c1b02c9e3a5506198c179dd7a32d01fbe.tar.gz nextcloud-server-96253c7c1b02c9e3a5506198c179dd7a32d01fbe.zip |
Add missing parent::__construct() calls to Jobs
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/federatedfilesharing')
-rw-r--r-- | apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index 4949e5794b4..14d86d4b444 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -29,6 +29,7 @@ namespace OCA\FederatedFileSharing\BackgroundJob; use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\Notifications; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\Job; use OCP\ILogger; @@ -55,29 +56,11 @@ class RetryJob extends Job { /** @var int how much time should be between two tries (10 minutes) */ private $interval = 600; - /** - * UnShare constructor. - * - * @param Notifications $notifications - */ - public function __construct(Notifications $notifications = null) { - if ($notifications) { - $this->notifications = $notifications; - } else { - $addressHandler = new AddressHandler( - \OC::$server->getURLGenerator(), - \OC::$server->getL10N('federatedfilesharing'), - \OC::$server->getCloudIdManager() - ); - $this->notifications = new Notifications( - $addressHandler, - \OC::$server->getHTTPClientService(), - \OC::$server->query(\OCP\OCS\IDiscoveryService::class), - \OC::$server->getJobList(), - \OC::$server->getCloudFederationProviderManager(), - \OC::$server->getCloudFederationFactory() - ); - } + + public function __construct(Notifications $notifications, + ITimeFactory $timeFactory) { + parent::__construct($timeFactory); + $this->notifications = $notifications; } /** @@ -126,7 +109,7 @@ class RetryJob extends Job { 'data' => $argument['data'], 'action' => $argument['action'], 'try' => (int)$argument['try'] + 1, - 'lastRun' => time() + 'lastRun' => $this->time->getTime() ] ); } @@ -139,6 +122,6 @@ class RetryJob extends Job { */ protected function shouldRun(array $argument) { $lastRun = (int)$argument['lastRun']; - return ((time() - $lastRun) > $this->interval); + return (($this->time->getTime() - $lastRun) > $this->interval); } } |