diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-08-23 16:55:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 16:55:42 +0200 |
commit | b888c6146327d842e21988b0d90d6ade4f3a9435 (patch) | |
tree | aa115b3d420cb6ccfa18a6a5af146eff8578b82c /lib/public/BackgroundJob/TimedJob.php | |
parent | 5f90a6a5e2da08e7098cc44937c1713375823e74 (diff) | |
parent | 49334e4d9c278d33ce9fd4195b5a12af99821be2 (diff) | |
download | nextcloud-server-b888c6146327d842e21988b0d90d6ade4f3a9435.tar.gz nextcloud-server-b888c6146327d842e21988b0d90d6ade4f3a9435.zip |
Merge pull request #33047 from nextcloud/fix/ijob-logger-deprecated
Deprecated ILogger from IJob
Diffstat (limited to 'lib/public/BackgroundJob/TimedJob.php')
-rw-r--r-- | lib/public/BackgroundJob/TimedJob.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php index 579486f6fbf..9d6b599c21b 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -36,13 +36,11 @@ use OCP\ILogger; * @since 15.0.0 */ abstract class TimedJob extends Job { - /** @var int */ - protected $interval = 0; - /** @var int */ - protected $timeSensitivity = IJob::TIME_SENSITIVE; + protected int $interval = 0; + protected int $timeSensitivity = IJob::TIME_SENSITIVE; /** - * set the interval for the job + * Set the interval for the job * * @param int $seconds the time to pass between two runs of the same job in seconds * @@ -89,10 +87,20 @@ abstract class TimedJob extends Job { * @param ILogger|null $logger * * @since 15.0.0 + * @deprecated since 25.0.0 Use start() instead */ final public function execute($jobList, ILogger $logger = null) { + $this->start($jobList); + } + + /** + * Run the job if the last run is is more than the interval ago + * + * @since 25.0.0 + */ + final public function start(IJobList $jobList): void { if (($this->time->getTime() - $this->lastRun) > $this->interval) { - parent::execute($jobList, $logger); + parent::start($jobList); } } } |