예제 #1
0
    require_once "bin/cli.php";
    $cli = new civicrm_cli();
    //if it doesn't die, it's authenticated
    //log the execution of script
    CRM_Core_Error::debug_log_message('EmailProcessor.php from the cli');
    require_once 'CRM/Core/Lock.php';
    $lock = new CRM_Core_Lock('EmailProcessor');
    if (!$lock->isAcquired()) {
        throw new Exception('Could not acquire lock, another EmailProcessor process is running');
    }
    // check if the script is being used for civimail processing or email to
    // activity processing.
    if (isset($cli->args[0]) && $cli->args[0] == "activities") {
        EmailProcessor::processActivities();
    } else {
        EmailProcessor::processBounces();
    }
    $lock->release();
    exit;
} else {
    session_start();
    require_once '../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    CRM_Utils_System::authenticateScript(true);
}
//log the execution of script
CRM_Core_Error::debug_log_message('EmailProcessor.php');
// load bootstrap to call hooks
require_once 'CRM/Utils/System.php';
CRM_Utils_System::loadBootStrap();