summaryrefslogtreecommitdiff
path: root/cron.php
blob: 9b3eb831db3cd6b9e5fd403310defb8a33aacf6a (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_once "includes/common.inc";

function cron_run() {
  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();

?>