From 2a0f7ba0a4b9297c2759a6a0691c14a988a5442d Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Fri, 24 Apr 2015 22:47:27 +0300 Subject: [PATCH] Skip previously scheduled jobs if app was disabled --- jobs/deletejob.php | 4 ++++ jobs/indexjob.php | 5 +++++ jobs/optimizejob.php | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/jobs/deletejob.php b/jobs/deletejob.php index 19b0b5f71..11f82791b 100644 --- a/jobs/deletejob.php +++ b/jobs/deletejob.php @@ -17,6 +17,7 @@ use OCA\Search_Lucene\Db\Status; use OCA\Search_Lucene\Db\StatusMapper; use OCA\Search_Lucene\Lucene\Index; +use OCP\App; class DeleteJob extends TimedJob { @@ -29,6 +30,9 @@ public function __construct() { * @param array $arguments */ public function run($arguments){ + if (!App::isEnabled('search_lucene')) { + return; + } $app = new Application(); $container = $app->getContainer(); diff --git a/jobs/indexjob.php b/jobs/indexjob.php index 54649c86e..8c358f776 100644 --- a/jobs/indexjob.php +++ b/jobs/indexjob.php @@ -14,6 +14,7 @@ use OCA\Search_Lucene\AppInfo\Application; use OCA\Search_Lucene\Core\Logger; use OC\BackgroundJob\QueuedJob; +use OCP\App; class IndexJob extends QueuedJob { @@ -21,6 +22,10 @@ class IndexJob extends QueuedJob { * @param array $arguments */ public function run($arguments){ + if (!App::isEnabled('search_lucene')) { + return; + } + $app = new Application(); $container = $app->getContainer(); diff --git a/jobs/optimizejob.php b/jobs/optimizejob.php index ded93ac7d..e0d78063a 100644 --- a/jobs/optimizejob.php +++ b/jobs/optimizejob.php @@ -14,6 +14,7 @@ use OCA\Search_Lucene\AppInfo\Application; use OCA\Search_Lucene\Core\Logger; use OC\BackgroundJob\TimedJob; +use OCP\App; class OptimizeJob extends TimedJob { @@ -25,6 +26,10 @@ public function __construct() { * @param array $arguments */ public function run($arguments){ + if (!App::isEnabled('search_lucene')) { + return; + } + $app = new Application(); $container = $app->getContainer(); /** @var Logger $logger */