aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/BackgroundJob/Job.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/BackgroundJob/Job.php')
-rw-r--r--lib/public/BackgroundJob/Job.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/public/BackgroundJob/Job.php b/lib/public/BackgroundJob/Job.php
index 3d1a117ac9e..2842486b74d 100644
--- a/lib/public/BackgroundJob/Job.php
+++ b/lib/public/BackgroundJob/Job.php
@@ -44,6 +44,7 @@ abstract class Job implements IJob, IParallelAwareJob {
protected $argument;
protected ITimeFactory $time;
protected bool $allowParallelRuns = true;
+ private ?ILogger $logger = null;
/**
* @since 15.0.0
@@ -55,13 +56,14 @@ abstract class Job implements IJob, IParallelAwareJob {
/**
* The function to prepare the execution of the job.
*
- * @return void
+ *
+ * @param IJobList $jobList
+ * @param ILogger|null $logger
*
* @since 15.0.0
- * @deprecated since 25.0.0 Use start() instead. This method will be removed
- * with the ILogger interface
*/
- public function execute(IJobList $jobList, ?ILogger $logger = null) {
+ public function execute(IJobList $jobList, ILogger $logger = null) {
+ $this->logger = $logger;
$this->start($jobList);
}
@@ -71,7 +73,7 @@ abstract class Job implements IJob, IParallelAwareJob {
*/
public function start(IJobList $jobList): void {
$jobList->setLastRun($this);
- $logger = \OCP\Server::get(LoggerInterface::class);
+ $logger = $this->logger ?? \OCP\Server::get(LoggerInterface::class);
try {
$jobDetails = get_class($this) . ' (id: ' . $this->getId() . ', arguments: ' . json_encode($this->getArgument()) . ')';
@@ -157,7 +159,6 @@ abstract class Job implements IJob, IParallelAwareJob {
* The actual function that is called to run the job
*
* @param $argument
- * @return void
*
* @since 15.0.0
*/