cron.php 426 Bytes
Newer Older
1
<?php
2

3
include_once "includes/common.inc";
4

Dries's avatar
Dries committed
5
function cron_run() {
6 7 8
  global $repository;

  $time = time();
Dries's avatar
Dries committed
9

10 11 12
  $result = db_query("SELECT * FROM crons WHERE $time - timestamp > scheduled");

  while ($task = db_fetch_object($result)) {
13
    if ($repository[$task->module]["cron"]) $repository[$task->module]["cron"]();
14 15 16 17
  }

  db_query("UPDATE crons SET timestamp = $time WHERE $time - timestamp > scheduled");
}
18

19
cron_run();
20

21
?>