public function run($now = NULL) { require_once 'CRM/Core/BAO/ActionSchedule.php'; CRM_Core_BAO_ActionSchedule::processQueue($now); }
/** * Send the scheduled reminders for all contacts (either for activities or events) * * @param array $params (reference ) input parameters * now - the time to use, in YmdHis format * - makes testing a bit simpler since we can simulate past/future time * * @return boolean true if success, else false * @static void * @access public * */ function civicrm_api3_job_send_reminder($params) { require_once 'CRM/Core/BAO/ActionSchedule.php'; $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params)); if ($result['is_error'] == 0) { return civicrm_api3_create_success(); } else { return civicrm_api3_create_error($result['messages']); } }
/** * Send the scheduled reminders for all contacts (either for activities or events). * * @param array $params * (reference ) input parameters. * now - the time to use, in YmdHis format * - makes testing a bit simpler since we can simulate past/future time * * @return array */ function civicrm_api3_job_send_reminder($params) { //note that $params['rowCount' can be overridden by one of the preferred syntaxes ($options['limit'] = x //It's not clear whether than syntax can be passed in via the UI config - but this keeps the pre 4.4.4 behaviour // in that case (ie. makes it non-configurable via the UI). Another approach would be to set a default of 0 // in the _spec function - but since that is a deprecated value it seems more contentious than this approach $params['rowCount'] = 0; $lock = Civi::lockManager()->acquire('worker.core.ActionSchedule'); if (!$lock->isAcquired()) { return civicrm_api3_create_error('Could not acquire lock, another ActionSchedule process is running'); } $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params), $params); $lock->release(); if ($result['is_error'] == 0) { return civicrm_api3_create_success(); } else { return civicrm_api3_create_error($result['messages']); } }
/** * Send the scheduled reminders for all contacts (either for activities or events) * * @param array $params (reference ) input parameters * now - the time to use, in YmdHis format * - makes testing a bit simpler since we can simulate past/future time * * @return boolean true if success, else false * @static void * @access public * */ function civicrm_api3_job_send_reminder($params) { $lock = new CRM_Core_Lock('civimail.job.EmailProcessor'); if (!$lock->isAcquired()) { return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running'); } $result = CRM_Core_BAO_ActionSchedule::processQueue(CRM_Utils_Array::value('now', $params), $params); $lock->release(); if ($result['is_error'] == 0) { return civicrm_api3_create_success(); } else { return civicrm_api3_create_error($result['messages']); } }