#!/usr/bin/php -q
$cron)
{
if($cron['active']==1)
{
$list[$func] = $cron;
}
}
}
require_once(e_HANDLER."cron_class.php");
$cron = new CronParser();
foreach($list as $func=>$val)
{
$cron->calcLastRan($val['tab']);
$due = $cron->getLastRanUnix();
if($due > (time()-45))
{
if(is_readable(e_PLUGIN.$val['path']."/e_cron.php"))
{
// echo date("r")." ".$func."\n";
require_once(e_PLUGIN.$val['path']."/e_cron.php");
require_once(e_HANDLER."mail.php");
$message = "Your Cron Job worked correctly. Sent at ".date("r").".";
sendemail($pref['siteadminemail'], "e107 - TEST Email Sent by cron.", $message, $pref['siteadmin'],$pref['siteadminemail'], $pref['siteadmin']);
if(call_user_func($func)===FALSE)
{
// echo "\nerror running the function ".$func.".\n"; log the error.
}
}
}
// echo "Cron Unix = ". $cron->getLastRanUnix();
// echo "
Now = ".time();
}
// echo "
Cron '$cron_str0' last due at: " . date('r', $cron->getLastRanUnix()) . "
";
// $cron->getLastRan() returns last due time in an array
// print_a($cron->getLastRan());
// echo "Debug:
" . nl2br($cron->getDebug());
/*
$cron_str1 = "3 12 * * *";
if ($cron->calcLastRan($cron_str1))
{
echo "
Cron '$cron_str1' last due at: " . date('r', $cron->getLastRanUnix()) . "
";
print_r($cron->getLastRan());
}
else
{
echo "Error parsing";
}
echo "Debug:
" . nl2br($cron->getDebug());
*/
exit;
?>