diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-09-19 00:37:55 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-09-19 00:37:55 +0200 |
commit | e2aeedb73b4cf872f588231b9aa90edbd4dfea6c (patch) | |
tree | f232076f08c956e98ff071846311ea7693d77e49 | |
parent | 5cce140701638aabac9ca692433b45517b741161 (diff) | |
download | nextcloud-server-chore/remove-ijob-execute.tar.gz nextcloud-server-chore/remove-ijob-execute.zip |
chore: Remove deprecated `IJob::execute` methodchore/remove-ijob-execute
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r-- | core/Command/Background/Job.php | 3 | ||||
-rw-r--r-- | core/Command/Background/JobWorker.php | 4 | ||||
-rw-r--r-- | lib/public/BackgroundJob/IJob.php | 19 | ||||
-rw-r--r-- | lib/public/BackgroundJob/Job.php | 16 | ||||
-rw-r--r-- | lib/public/BackgroundJob/QueuedJob.php | 17 | ||||
-rw-r--r-- | lib/public/BackgroundJob/TimedJob.php | 17 |
6 files changed, 12 insertions, 64 deletions
diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php index 7fa005cf231..617eeac938c 100644 --- a/core/Command/Background/Job.php +++ b/core/Command/Background/Job.php @@ -67,8 +67,7 @@ class Job extends Command { $output->writeln('<error>Something went wrong when trying to retrieve Job with ID ' . $jobId . ' from database</error>'); return 1; } - /** @psalm-suppress DeprecatedMethod Calling execute until it is removed, then will switch to start */ - $job->execute($this->jobList); + $job->start($this->jobList); $job = $this->jobList->getById($jobId); if (($job === null) || ($lastRun !== $job->getLastRun())) { diff --git a/core/Command/Background/JobWorker.php b/core/Command/Background/JobWorker.php index 8289021887b..a2da18440a2 100644 --- a/core/Command/Background/JobWorker.php +++ b/core/Command/Background/JobWorker.php @@ -125,9 +125,7 @@ class JobWorker extends JobBase { $this->printJobInfo($job->getId(), $job, $output); } - /** @psalm-suppress DeprecatedMethod Calling execute until it is removed, then will switch to start */ - $job->execute($this->jobList); - + $job->start($this->jobList); $output->writeln('Job ' . $job->getId() . ' has finished', OutputInterface::VERBOSITY_VERBOSE); // clean up after unclean jobs diff --git a/lib/public/BackgroundJob/IJob.php b/lib/public/BackgroundJob/IJob.php index 6988e1e682a..677ea2187e6 100644 --- a/lib/public/BackgroundJob/IJob.php +++ b/lib/public/BackgroundJob/IJob.php @@ -7,15 +7,15 @@ */ namespace OCP\BackgroundJob; -use OCP\ILogger; - /** - * This interface represend a backgroud job run with cron + * This interface represents a background job run by cron * * To implement a background job, you must extend either \OCP\BackgroundJob\Job, * \OCP\BackgroundJob\TimedJob or \OCP\BackgroundJob\QueuedJob * * @since 7.0.0 + * @since 25.0.0 deprecated `execute()` method in favor of `start()` + * @since 31.0.0 removed deprecated `execute()` method */ interface IJob { /** @@ -28,24 +28,13 @@ interface IJob { public const TIME_SENSITIVE = 1; /** - * Run the background job with the registered argument - * - * @param IJobList $jobList The job list that manages the state of this job - * @param ILogger|null $logger - * @since 7.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); - - /** * Start the background job with the registered argument * * This methods will take care of running the background job, of initializing * the state and cleaning up the job list after running the job. * * For common background job scenario, you will want to use TimedJob or QueuedJob - * instead of overwritting this method. + * instead of overwriting this method. * * @param IJobList $jobList The job list that manages the state of this job * @since 25.0.0 diff --git a/lib/public/BackgroundJob/Job.php b/lib/public/BackgroundJob/Job.php index 3b25db311a4..606d71bbaf0 100644 --- a/lib/public/BackgroundJob/Job.php +++ b/lib/public/BackgroundJob/Job.php @@ -8,7 +8,6 @@ declare(strict_types=1); namespace OCP\BackgroundJob; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\ILogger; use Psr\Log\LoggerInterface; /** @@ -18,6 +17,8 @@ use Psr\Log\LoggerInterface; * For the most common use cases have a look at QueuedJob and TimedJob * * @since 15.0.0 + * @since 25.0.0 deprecated `execute()` method in favor of `start()` + * @since 31.0.0 removed deprecated `execute()` method */ abstract class Job implements IJob, IParallelAwareJob { protected int $id = 0; @@ -34,19 +35,6 @@ abstract class Job implements IJob, IParallelAwareJob { } /** - * The function to prepare the execution of the job. - * - * @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->start($jobList); - } - - /** * @inheritdoc * @since 25.0.0 */ diff --git a/lib/public/BackgroundJob/QueuedJob.php b/lib/public/BackgroundJob/QueuedJob.php index caacff42b1a..f66dfd0c4a0 100644 --- a/lib/public/BackgroundJob/QueuedJob.php +++ b/lib/public/BackgroundJob/QueuedJob.php @@ -7,27 +7,14 @@ declare(strict_types=1); */ namespace OCP\BackgroundJob; -use OCP\ILogger; - /** * Simple base class for a one time background job * * @since 15.0.0 + * @since 25.0.0 deprecated `execute()` method in favor of `start()` + * @since 31.0.0 removed deprecated `execute()` method */ abstract class QueuedJob extends Job { - /** - * Run the job, then remove it from the joblist - * - * @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 - */ - final public function execute($jobList, ?ILogger $logger = null) { - $this->start($jobList); - } /** * Run the job, then remove it from the joblist diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php index 6665d194789..c93456edd09 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -7,13 +7,13 @@ declare(strict_types=1); */ namespace OCP\BackgroundJob; -use OCP\ILogger; - /** * Simple base class to extend to run periodic background jobs. * Call setInterval with your desired interval in seconds from the constructor. * * @since 15.0.0 + * @since 25.0.0 deprecated `execute()` method in favor of `start()` + * @since 31.0.0 removed deprecated `execute()` method */ abstract class TimedJob extends Job { protected int $interval = 0; @@ -63,19 +63,6 @@ abstract class TimedJob extends Job { /** * Run the job if the last run is more than the interval ago * - * @param IJobList $jobList - * @param ILogger|null $logger - * - * @since 15.0.0 - * @deprecated since 25.0.0 Use start() instead - */ - final public function execute(IJobList $jobList, ?ILogger $logger = null) { - $this->start($jobList); - } - - /** - * Run the job if the last run is more than the interval ago - * * @since 25.0.0 */ final public function start(IJobList $jobList): void { |