function checkJob(&$job) { $last_run = strftime(DB_DATE_FORMAT, time() - $job->interval); $count = sqll_value("SELECT COUNT(*) FROM `sys_cron` WHERE `name`='&1' AND `last_run`>'&2' AND `last_run`<=NOW()", 0, $job->name, $last_run); if ($count != 1) { $job->run(); sqll("INSERT INTO `sys_cron` (`name`, `last_run`) VALUES ('&1', NOW()) ON DUPLICATE KEY UPDATE `last_run`=NOW()", $job->name); } }
function checkJob(&$job) { global $ignore_interval; $max_last_run = strftime(DB_DATE_FORMAT, time() - ($ignore_interval ? 0 : $job->interval)); $count = sqll_value("SELECT COUNT(*)\n FROM `sys_cron`\n WHERE\n `name` = '&1'\n AND `last_run` > '&2'\n AND `last_run` <= NOW()", 0, $job->name, $max_last_run); if ($count != 1) { $job->run(); sqll("INSERT INTO `sys_cron` (`name`, `last_run`)\n VALUES ('&1', NOW())\n ON DUPLICATE KEY UPDATE `last_run` = NOW()", $job->name); } }