aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/BackgroundJob
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-08 15:31:19 +0100
committerLouis Chemineau <louis@chmn.me>2024-02-08 15:31:19 +0100
commit898df41de968321926e10ad532a64c3915ddad29 (patch)
tree57a0e5ada151890ddf71550f22b502e1f67aeffd /lib/public/BackgroundJob
parentd9d60238c7aaab9c61bf2d50c15aa59bc88c8975 (diff)
downloadnextcloud-server-898df41de968321926e10ad532a64c3915ddad29.tar.gz
nextcloud-server-898df41de968321926e10ad532a64c3915ddad29.zip
Revert "Merge branch 'master' of github.com:nextcloud/server"
This reverts commit d9d60238c7aaab9c61bf2d50c15aa59bc88c8975, reversing changes made to ba3fdb0cdcfbb84f0080a2146a4ba2f01569915d.
Diffstat (limited to 'lib/public/BackgroundJob')
-rw-r--r--lib/public/BackgroundJob/IJobList.php4
-rw-r--r--lib/public/BackgroundJob/Job.php13
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/public/BackgroundJob/IJobList.php b/lib/public/BackgroundJob/IJobList.php
index 07b5ebcf48b..0b00326ca1a 100644
--- a/lib/public/BackgroundJob/IJobList.php
+++ b/lib/public/BackgroundJob/IJobList.php
@@ -32,8 +32,8 @@ namespace OCP\BackgroundJob;
* This interface provides functions to register background jobs
*
* To create a new background job create a new class that inherits from either
- * \OCP\BackgroundJob\Job, \OCP\BackgroundJob\QueuedJob or
- * \OCP\BackgroundJob\TimedJob and register it using ->add($job, $argument),
+ * \OC\BackgroundJob\Job, \OC\BackgroundJob\QueuedJob or
+ * \OC\BackgroundJob\TimedJob and register it using ->add($job, $argument),
* $argument will be passed to the run() function of the job when the job is
* executed.
*
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
*/