summaryrefslogtreecommitdiff
path: root/cron.php
blob: 3cb6abfcb093db8f502d21bbb437c632c2224476 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?

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();

?>