| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | This work is published under the GNU AGPLv3 license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | |
| 13 | require_once '../civicrm.config.php'; |
| 14 | require_once 'CRM/Core/Config.php'; |
| 15 | require_once 'CRM/Utils/Request.php'; |
| 16 | CRM_Core_Config::singleton(); |
| 17 | |
| 18 | CRM_Utils_System::authenticateScript(TRUE); |
| 19 | |
| 20 | $job = CRM_Utils_Request::retrieve('job', 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST'); |
| 21 | |
| 22 | require_once 'CRM/Core/JobManager.php'; |
| 23 | $facility = new CRM_Core_JobManager(); |
| 24 | |
| 25 | if ($job === NULL) { |
| 26 | $facility->execute(); |
| 27 | } |
| 28 | else { |
| 29 | $ignored = array("name", "pass", "key", "job"); |
| 30 | $params = array(); |
| 31 | foreach ($_REQUEST as $name => $value) { |
| 32 | if (!in_array($name, $ignored)) { |
| 33 | $params[$name] = CRM_Utils_Request::retrieve($name, 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST'); |
| 34 | } |
| 35 | } |
| 36 | $facility->setSingleRunParams('job', $job, $params, 'From cron.php'); |
| 37 | $facility->executeJobByAction('job', $job); |
| 38 | } |