Пример #1
0
function cronCheck()
{
    if ($_GET['type'] == 'manage') {
        //easyCron triggered
        define('CRON_MODE', 'easyCronManage');
        $getNextTaskScheduleTime = getNextTaskScheduleTime();
        if (!empty($getNextTaskScheduleTime) && $getNextTaskScheduleTime < time() + 30 * 60) {
            //if manageCron trigger at 00:00. say a cron task scheduled at 00:10, it will be accepted by this if which checks less then 00:30, cronTask which will disable it self, it will keep triggering for every minutue even it doesnt have any task to execute
            $result = manageEasyCron::taskCronEnable();
            if ($result['status'] == 'error') {
                addNotification($type = 'E', $title = 'Easy Cron API Error', $result['error']['message'], $state = 'U');
            }
        }
        die;
    } elseif ($_GET['type'] == 'task') {
        //easyCron triggered
        define('CRON_MODE', 'easyCronTask');
        define('CRON_TIMEOUT', 30);
    } else {
        $freq = getSystemCronRunningFrequency();
        if ($freq == 5) {
            //5 min system cron
            define('CRON_MODE', 'systemCronShortTime');
            define('CRON_TIMEOUT', 310);
        } else {
            //should be 20 min system cron
            define('CRON_MODE', 'systemCronDefault');
            define('CRON_TIMEOUT', 1210);
        }
    }
}
Пример #2
0
 public static function getSystemCronRunningFrequency()
 {
     return getSystemCronRunningFrequency();
 }