示例#1
0
function executeScheduledCases($sNow = null)
{
    try {
        global $sFilter;
        global $sNow;
        $log = array();
        if ($sFilter != '' && strpos($sFilter, 'scheduler') === false) {
            return false;
        }
        setExecutionMessage("Executing the scheduled starting cases");
        setExecutionResultMessage('PROCESSING');
        $sNow = isset($sNow) ? $sNow : date('Y-m-d H:i:s');
        $oCaseScheduler = new CaseScheduler();
        $oCaseScheduler->caseSchedulerCron($sNow, $log, 1);
        foreach ($log as $value) {
            $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
            $arrayCron["processcTimeStart"] = time();
            @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
            saveLog('executeScheduledCases', 'action', "OK Case# {$value}");
        }
        setExecutionResultMessage('DONE');
    } catch (Exception $oError) {
        setExecutionResultMessage('WITH ERRORS', 'error');
        eprintln("  '-" . $oError->getMessage(), 'red');
    }
}
示例#2
0
function executeScheduledCases($sNow = null)
{
    try {
        global $sFilter;
        global $sNow;
        $log = array();
        if ($sFilter != '' && strpos($sFilter, 'scheduler') === false) {
            return false;
        }
        setExecutionMessage("Executing the scheduled starting cases");
        setExecutionResultMessage('PROCESSING');
        $sNow = isset($sNow) ? $sNow : date('Y-m-d H:i:s');
        $oCaseScheduler = new CaseScheduler();
        $oCaseScheduler->caseSchedulerCron($sNow, $log);
        foreach ($log as $value) {
            saveLog('executeScheduledCases', 'action', "OK Case# {$value}");
        }
        setExecutionResultMessage('DONE');
    } catch (Exception $oError) {
        setExecutionResultMessage('WITH ERRORS', 'error');
        eprintln("  '-" . $oError->getMessage(), 'red');
    }
}