示例#1
0
function cron_next_run_time($lastrun, $job)
{
    //error_log("cron_next_run_time($lastrun, (object)job) job['timezone'] = {$job['timezone']}");
    $run_date = usergetdate($lastrun, $job['timezone']);
    // we don't care about seconds for cron
    $run_date['seconds'] = 0;
    // get the specified timezone
    $run_date['timezone'] = $job['timezone'];
    // assert valid month
    if (!cron_valid_month($job, $run_date)) {
        cron_next_month($job, $run_date);
        cron_first_day($job, $run_date);
        cron_first_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    // assert valid day
    if (!cron_valid_day($job, $run_date)) {
        cron_next_day($job, $run_date);
        cron_first_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    // assert valid hour
    if (!cron_valid_hour($job, $run_date)) {
        cron_next_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    cron_next_minute($job, $run_date);
    return datearray_to_timestamp($run_date);
}
示例#2
0
function cron_next_run_time($lastrun, $job)
{
    $run_date = getdate($lastrun);
    // we don't care about seconds for cron
    $run_date['seconds'] = 0;
    // assert valid month
    if (!cron_valid_month($job, $run_date)) {
        cron_next_month($job, $run_date);
        cron_first_day($job, $run_date);
        cron_first_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    // assert valid day
    if (!cron_valid_day($job, $run_date)) {
        cron_next_day($job, $run_date);
        cron_first_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    // assert valid hour
    if (!cron_valid_hour($job, $run_date)) {
        cron_next_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    cron_next_minute($job, $run_date);
    return datearray_to_timestamp($run_date);
}
示例#3
0
文件: tasklib.php 项目: jamesmcq/elis
function cron_next_run_time($lastrun, $job)
{
    //error_log("cron_next_run_time($lastrun, (object)job) job['timezone'] = {$job['timezone']}");
    $run_date = usergetdate($lastrun, $job['timezone']);
    // we don't care about seconds for cron
    $run_date['seconds'] = 0;
    // get the specified timezone
    $run_date['timezone'] = $job['timezone'];
    // ELIS-8580: Fix for '00' hour, minute & dayofweek used in task definintions to not be seen as empty '0'
    if ($job['dayofweek'] == '00') {
        $job['dayofweek'] = '0';
    }
    if ($job['hour'] == '00') {
        $job['hour'] = '0';
    }
    if ($job['minute'] == '00') {
        $job['minute'] = '0';
    }
    // assert valid month
    if (!cron_valid_month($job, $run_date)) {
        cron_next_month($job, $run_date);
        cron_first_day($job, $run_date);
        cron_first_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    // assert valid day
    if (!cron_valid_day($job, $run_date)) {
        cron_next_day($job, $run_date);
        cron_first_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    // assert valid hour
    if (!cron_valid_hour($job, $run_date)) {
        cron_next_hour($job, $run_date);
        cron_first_minute($job, $run_date);
        return datearray_to_timestamp($run_date);
    }
    cron_next_minute($job, $run_date);
    return datearray_to_timestamp($run_date);
}