diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-02-06 11:22:09 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-02-08 10:28:29 +0100 |
commit | 166773879ba20bf7b81f3996a7c4e2a9ff7ee16d (patch) | |
tree | ee8c3115167e71c115f56479612be08c574761f1 /lib/public/BackgroundJob/Job.php | |
parent | 9e9040196f94e9650ce847e9feb9f23ad8d19ada (diff) | |
download | nextcloud-server-166773879ba20bf7b81f3996a7c4e2a9ff7ee16d.tar.gz nextcloud-server-166773879ba20bf7b81f3996a7c4e2a9ff7ee16d.zip |
fix!: Migrate jobs away from deprecated interfaces
BREAKING CHANGE: Removed ILogFactory::getCustomLogger deprecated method
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/public/BackgroundJob/Job.php')
-rw-r--r-- | lib/public/BackgroundJob/Job.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/public/BackgroundJob/Job.php b/lib/public/BackgroundJob/Job.php index 2842486b74d..3d1a117ac9e 100644 --- a/lib/public/BackgroundJob/Job.php +++ b/lib/public/BackgroundJob/Job.php @@ -44,7 +44,6 @@ abstract class Job implements IJob, IParallelAwareJob { protected $argument; protected ITimeFactory $time; protected bool $allowParallelRuns = true; - private ?ILogger $logger = null; /** * @since 15.0.0 @@ -56,14 +55,13 @@ abstract class Job implements IJob, IParallelAwareJob { /** * The function to prepare the execution of the job. * - * - * @param IJobList $jobList - * @param ILogger|null $logger + * @return void * * @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) { - $this->logger = $logger; + public function execute(IJobList $jobList, ?ILogger $logger = null) { $this->start($jobList); } @@ -73,7 +71,7 @@ abstract class Job implements IJob, IParallelAwareJob { */ public function start(IJobList $jobList): void { $jobList->setLastRun($this); - $logger = $this->logger ?? \OCP\Server::get(LoggerInterface::class); + $logger = \OCP\Server::get(LoggerInterface::class); try { $jobDetails = get_class($this) . ' (id: ' . $this->getId() . ', arguments: ' . json_encode($this->getArgument()) . ')'; @@ -159,6 +157,7 @@ abstract class Job implements IJob, IParallelAwareJob { * The actual function that is called to run the job * * @param $argument + * @return void * * @since 15.0.0 */ |