Location: PHPKode > scripts > Dornbase > scripts/cron.php
<?php
$query = "SELECT id,next FROM cron LIMIT 1";
$row = db_firstrow($query,"Error checking cronjob");

if(!$row) {
	$query = "INSERT INTO cron (`next`) VALUES (NOW())";
	query_db($query,"Error creating cronjob");
	$next = 0;
	$cronid = mysql_insert_id();
}
else {
	$next = datetimetounix($row['next']);
	$cronid = $row['id'];
}

if($_REQUEST['cron'] || $next<time()) {

	$tomorrow = strtotime("+1 day");
	$nextupdate = date("Y-m-d 12:00:00",$tomorrow);

	//loop through files in cron folder
	foreach(glob('cron/*.php') as $filename) {
		print_debug("Running cronjob: $filename",2);
		include $filename;
	}	
	
	$query = "UPDATE cron SET next = '$nextupdate' WHERE id='$cronid'";
	query_db($query,"Error setting next cronjob");
}
?>
Return current item: Dornbase