Esempio n. 1
0
| See the GNU Affero General Public License for more details.        |
|                                                                    |
| You should have received a copy of the GNU Affero General Public   |
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
require_once 'CRM/Utils/Request.php';
$config = CRM_Core_Config::singleton();
CRM_Utils_System::authenticateScript(TRUE);
$job = CRM_Utils_Request::retrieve('job', 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST');
require_once 'CRM/Core/JobManager.php';
$facility = new CRM_Core_JobManager();
if ($job === NULL) {
    $facility->execute();
} else {
    $ignored = array("name", "pass", "key", "job");
    $params = array();
    foreach ($_REQUEST as $name => $value) {
        if (!in_array($name, $ignored)) {
            $params[$name] = CRM_Utils_Request::retrieve($name, 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST');
        }
    }
    $facility->setSingleRunParams('job', $job, $params, 'From cron.php');
    $facility->executeJobByAction('job', $job);
}
Esempio n. 2
0
 /**
  * @return bool
  */
 public function callApi()
 {
     require_once 'api/api.php';
     //  CRM-9822 -'execute' action always goes thru Job api and always writes to log
     if ($this->_action != 'execute' && $this->_joblog) {
         require_once 'CRM/Core/JobManager.php';
         $facility = new CRM_Core_JobManager();
         $facility->setSingleRunParams($this->_entity, $this->_action, $this->_params, 'From Cli.php');
         $facility->executeJobByAction($this->_entity, $this->_action);
     } else {
         // CRM-9822 cli.php calls don't require site-key, so bypass site-key authentication
         $this->_params['auth'] = FALSE;
         $result = civicrm_api($this->_entity, $this->_action, $this->_params);
     }
     if ($result['is_error'] != 0) {
         $this->_log($result['error_message']);
         return FALSE;
     } elseif ($this->_output) {
         print_r($result['values']);
     }
     return TRUE;
 }
Esempio n. 3
0
 /**
  * Implementation of command 'process-mail-queue'
  */
 private function processMailQueue()
 {
     civicrm_initialize();
     if (substr(CRM_Utils_System::version(), 0, 3) >= '4.3') {
         $job = new CRM_Core_JobManager();
         $job->executeJobByAction('job', 'process_mailing');
         WP_CLI::success("Executed 'process_mailing' job.");
     } else {
         $result = civicrm_api('Mailing', 'Process', array('version' => 3));
         if ($result['is_error']) {
             WP_CLI::error($result['error_message']);
         }
     }
 }