From 73bf1fb050688b8121832d359c34502ccd3d6aa8 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 22 Jul 2020 16:47:41 +0200 Subject: [PATCH] Reverted changes added by commit be7ea871be8959da83763e8df05f6a6c0fb0e471 --- application/config/jqm.php | 8 --- .../system/jq/JobsQueueScheduler.php | 47 ------------- application/libraries/JobsQueueLib.php | 68 ------------------- 3 files changed, 123 deletions(-) delete mode 100644 application/controllers/system/jq/JobsQueueScheduler.php diff --git a/application/config/jqm.php b/application/config/jqm.php index 541183deb..43cc1c038 100644 --- a/application/config/jqm.php +++ b/application/config/jqm.php @@ -12,11 +12,3 @@ $config['job_type_permissions_white_list'] = array( 'SAPPayment' => 'developer:rw' ); -// List of schedulers that can be run by the scheduler -$config['job_schedulers_list'] = array( // Controllers - 'extensions/FHC-Core-SAP/JQMScheduler' => array( // Methods - 'newUsers', - 'updateUsers' - ) -); - diff --git a/application/controllers/system/jq/JobsQueueScheduler.php b/application/controllers/system/jq/JobsQueueScheduler.php deleted file mode 100644 index 157b8979f..000000000 --- a/application/controllers/system/jq/JobsQueueScheduler.php +++ /dev/null @@ -1,47 +0,0 @@ -logInfo('Scheduler started'); - - $schedulerResult = $this->jobsqueuelib->schedule(); - - // If error occurred then log it - if (isError($schedulerResult)) $this->logError(getError($schedulerResult)); - - // If non blocking errors occurred log them - if (hasData($schedulerResult) && !isEmptyArray(getData($schedulerResult))) - { - foreach (getData($schedulerResult) as $nonBlockingError) - { - $this->logWarning($nonBlockingError); - } - } - - $this->logInfo('Scheduler ended'); - } -} - diff --git a/application/libraries/JobsQueueLib.php b/application/libraries/JobsQueueLib.php index fa9f3890b..c37d800a7 100644 --- a/application/libraries/JobsQueueLib.php +++ b/application/libraries/JobsQueueLib.php @@ -24,9 +24,6 @@ class JobsQueueLib const PROPERTY_END_TIME = 'endtime'; const PROPERTY_ERROR = 'error'; - // Config entries - const JOB_SCHEDULERS_LIST = 'job_schedulers_list'; - private $_ci; // CI instance /** @@ -42,9 +39,6 @@ class JobsQueueLib $this->_ci->load->model('system/JobTypes_model', 'JobTypesModel'); $this->_ci->load->model('system/JobStatuses_model', 'JobStatusesModel'); $this->_ci->load->model('system/JobTriggers_model', 'JobTriggersModel'); - - // Loads configs - $this->_ci->config->load('jqm'); } //------------------------------------------------------------------------------------------------------------------ @@ -202,68 +196,6 @@ class JobsQueueLib return success($results); // otherwise return results in a success object } - /** - * Checks the job object structure when needed for insert - */ - public function schedule() - { - // An array of non blocking errors - $nonBlockingErrorsArray = array(); - - // Get the all the configured schedulers - $schedulers = $this->_ci->config->item(self::JOB_SCHEDULERS_LIST); - - // If is it empty then non blocking error - if (isEmptyArray($schedulers)) return success('No schedulers where configured'); - - // For each scheduler - foreach ($schedulers as $controller => $methods) - { - // If the specified controller does not exist - if (!file_exists(APPPATH.'controllers/'.$controller.'.php')) - { - $nonBlockingErrorsArray[] = 'The controller '.$controller.' does not exist'; - } - else // try to call it - { - $arrayMethods = array(); - - // If methods is a string - if (is_string($methods)) - { - $arrayMethods[] = $methods; - } - elseif (is_array($methods)) // otherwise if is an array - { - $arrayMethods = $methods; - } - - // For eache configured method - foreach ($arrayMethods as $method) - { - // Generate command string - $command = sprintf( - 'php %s/../index.ci.php %s %s >> %s/logs/scheduler-%s-%s.log 2>>%s/logs/scheduler-error-%s-%s.log &', - APPPATH, - $controller, - $method, - APPPATH, - str_replace('/', '-', $controller), - date('Y-m-d'), - APPPATH, - str_replace('/', '-', $controller), - date('Y-m-d') - ); - - // Execute command string - @shell_exec($command); - } - } - } - - return success($nonBlockingErrorsArray); - } - //------------------------------------------------------------------------------------------------------------------ // Private methods