diff options
author | Benjamin Brahmer <info@b-brahmer.de> | 2023-03-02 16:19:49 +0100 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2023-03-02 17:51:53 +0100 |
commit | 04fcda9b1a1016e08316e14fef182d1955b5e4e6 (patch) | |
tree | 5ad794c638964d67eb4ce039d7e1dcc359280434 /lib | |
parent | e6117020c05adc2fbd7bdf724766cdf523ff7a93 (diff) |
Remove unused job from db
Our background job was renamed quite a while ago
the old job remained in the db, to prevent confusion this adds
a repair step to remove the old job.
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/RemoveUnusedJob.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/Migration/RemoveUnusedJob.php b/lib/Migration/RemoveUnusedJob.php new file mode 100644 index 000000000..b0202f5a4 --- /dev/null +++ b/lib/Migration/RemoveUnusedJob.php @@ -0,0 +1,51 @@ +<?php +namespace OCA\News\Migration; + +use OCP\Migration\IOutput; +use OCP\Migration\IRepairStep; +use Psr\Log\LoggerInterface; +use OCP\BackgroundJob\IJobList; + +class RemoveUnusedJob implements IRepairStep +{ + + /** + * @var LoggerInterface + */ + protected $logger; + + /** + * @var IJobList + */ + protected $joblist; + + public function __construct(LoggerInterface $logger, IJobList $jobList) + { + + $this->logger = $logger; + $this->joblist = $jobList; + } + + /** + * Returns the step's name + */ + public function getName() + { + return 'Remove the unused News update job'; + } + + /** + * @param IOutput $output + */ + public function run(IOutput $output) + { + if($this->joblist->has("OCA\News\Cron\Updater", null)){ + $output->info("Job exists, attempting to remove"); + $this->joblist->remove("OCA\News\Cron\Updater"); + $output->info("Job removed"); + } else { + $output->info("Job does not exist, all good"); + } + + } +}
\ No newline at end of file |