예제 #1
0
파일: cron.php 프로젝트: dudor/ecshop
        }
        if (!empty($cron_val['cron_config'])) {
            foreach ($cron_val['cron_config'] as $k => $v) {
                $cron[$v['name']] = $v['value'];
            }
        }
        include_once ROOT_PATH . 'includes/modules/cron/' . $cron_val['cron_code'] . '.php';
    } else {
        $error_log[] = make_error_arr('includes/modules/cron/' . $cron_val['cron_code'] . '.php not found!', __FILE__);
    }
    $close = $cron_val['run_once'] ? 0 : 1;
    $next_time = get_next_time($cron_val['cron']);
    $sql = "UPDATE " . $ecs->table('crons') . "SET thistime = '{$timestamp}', nextime = '{$next_time}', enable = {$close} " . "WHERE cron_id = '{$cron_val['cron_id']}' LIMIT 1";
    $db->query($sql);
}
write_error_arr($error_log);
function get_next_time($cron)
{
    $y = local_date('Y', $GLOBALS['timestamp']);
    $mo = local_date('n', $GLOBALS['timestamp']);
    $d = local_date('j', $GLOBALS['timestamp']);
    $w = local_date('w', $GLOBALS['timestamp']);
    $h = local_date('G', $GLOBALS['timestamp']);
    $sh = $sm = 0;
    $sy = $y;
    if ($cron['day']) {
        $sd = $cron['day'];
        $smo = $mo + 1;
    } else {
        $sd = $d;
        $smo = $mo;
예제 #2
0
파일: cron.php 프로젝트: GYWang1983/fruit
        $cron = $cron_val['cron'];
        if (!empty($cron_val['cron_config'])) {
            foreach ($cron_val['cron_config'] as $k => $v) {
                $cron[$v['name']] = $v['value'];
            }
        }
        include_once ROOT_PATH . 'includes/modules/cron/' . $cron_val['cron_code'] . '.php';
    } else {
        $error_log[] = make_error_arr('includes/modules/cron/' . $cron_val['cron_code'] . '.php not found!', __FILE__);
    }
    $close = $cron_val['run_once'] ? 0 : 1;
    $next_time = get_next_time($cron);
    $sql = "UPDATE " . $ecs->table('crons') . "SET thistime = '{$timestamp}', nextime = '{$next_time}', enable = {$close} " . "WHERE cron_id = '{$cron_val['cron_id']}' LIMIT 1";
    $db->query($sql);
}
write_error_arr($error_log, 'cron');
function get_next_time($cron)
{
    if (!empty($cron['minuts_interval'])) {
        $next = $GLOBALS['timestamp'] + 60 * intval($cron['minuts_interval']);
    } else {
        $y = local_date('Y', $GLOBALS['timestamp']);
        $mo = local_date('n', $GLOBALS['timestamp']);
        $d = local_date('j', $GLOBALS['timestamp']);
        $w = local_date('w', $GLOBALS['timestamp']);
        $h = local_date('G', $GLOBALS['timestamp']);
        $sh = $sm = 0;
        $sy = $y;
        if ($cron['day']) {
            $sd = $cron['day'];
            $smo = $mo + 1;