summaryrefslogtreecommitdiff
path: root/cron.php
diff options
context:
space:
mode:
Diffstat (limited to 'cron.php')
-rw-r--r--cron.php21
1 files changed, 19 insertions, 2 deletions
diff --git a/cron.php b/cron.php
index 376792366..3cb6abfcb 100644
--- a/cron.php
+++ b/cron.php
@@ -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