summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2023-03-02 16:19:49 +0100
committerBenjamin Brahmer <info@b-brahmer.de>2023-03-02 17:51:53 +0100
commit04fcda9b1a1016e08316e14fef182d1955b5e4e6 (patch)
tree5ad794c638964d67eb4ce039d7e1dcc359280434 /lib
parente6117020c05adc2fbd7bdf724766cdf523ff7a93 (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.php51
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