diff options
Diffstat (limited to 'cron.php')
-rw-r--r-- | cron.php | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -1,7 +1,24 @@ <? -include "includes/cron.inc"; +include "includes/theme.inc"; + +function cron_run($cron) { + global $repository; + + $time = time(); + + $result = db_query("SELECT * FROM crons WHERE $time - timestamp > scheduled"); + + while ($task = db_fetch_object($result)) { + if ($repository[$task->module]["cron"]) { + watchdog("message", "cron: executed '". $task->module ."_cron()'"); + $repository[$task->module]["cron"](); + } + } + + db_query("UPDATE crons SET timestamp = $time WHERE $time - timestamp > scheduled"); +} cron_run(); -?> +?>
\ No newline at end of file |