diff options
author | Devlin Junker <devlin.junker@gmail.com> | 2023-08-05 19:16:39 -0700 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2023-08-09 11:08:04 +0200 |
commit | 923f986e67413ac548cc98d6d59fa01de9681035 (patch) | |
tree | a3d1fb38fd28388686b0c394d4824af30b959fd7 /lib/Migration/RemoveUnusedJob.php | |
parent | 450047ef4be0d39ba8a5e5e5ac0d6e87b7203ebb (diff) |
upmerged from master
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'lib/Migration/RemoveUnusedJob.php')
-rw-r--r-- | lib/Migration/RemoveUnusedJob.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/Migration/RemoveUnusedJob.php b/lib/Migration/RemoveUnusedJob.php new file mode 100644 index 000000000..cb5c5fecc --- /dev/null +++ b/lib/Migration/RemoveUnusedJob.php @@ -0,0 +1,50 @@ +<?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"); + } + } +} |