Esempio n. 1
0
 public function testHookCron()
 {
     $hook = $this->getMock('stdClass', array('civicrm_cron'));
     $hook->expects($this->once())->method('civicrm_cron')->with($this->isInstanceOf('CRM_Core_JobManager'));
     CRM_Utils_Hook::singleton()->setMock($hook);
     $jobManager = new CRM_Core_JobManager();
     $jobManager->execute(FALSE);
 }
Esempio n. 2
0
/**
 * Dumb wrapper to execute scheduled jobs. Always creates success - errors
 * and results are handled in the job log.
 *
 * @param  array   	  $params (reference ) input parameters
 *
 * @return array API Result Array
 *
 * @static void
 * @access public
 *
 */
function civicrm_api3_job_execute($params)
{
    require_once 'CRM/Core/JobManager.php';
    $facility = new CRM_Core_JobManager();
    $facility->execute(CRM_Utils_Array::value('auth', $params, TRUE));
    // always creates success - results are handled elsewhere
    return civicrm_api3_create_success();
}
Esempio n. 3
0
 /**
  */
 public static function executeScheduledJobs()
 {
     $facility = new CRM_Core_JobManager();
     $facility->execute(FALSE);
     $redirectUrl = self::url('civicrm/admin/job', 'reset=1');
     CRM_Core_Session::setStatus(ts('Scheduled jobs have been executed according to individual timing settings. Please check log for messages.'), ts('Complete'), 'success');
     CRM_Utils_System::redirect($redirectUrl);
 }
Esempio n. 4
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. 5
0
/**
 * Dumb wrapper to execute scheduled jobs.
 *
 * Always creates success - errors and results are handled in the job log.
 *
 * @param array $params
 *   input parameters (unused).
 *
 * @return array
 *   API Result Array
 */
function civicrm_api3_job_execute($params)
{
    $facility = new CRM_Core_JobManager();
    $facility->execute(FALSE);
    // Always creates success - results are handled elsewhere.
    return civicrm_api3_create_success(1, $params, 'Job');
}