cron fixes, time is now based on last run not now()

This commit is contained in:
Ulf Gebhardt 2014-11-20 13:56:39 +01:00
parent 71825f11a5
commit 51f12b4ce8
2 changed files with 9 additions and 5 deletions

View File

@ -41,11 +41,12 @@ class cron {
if(!self::check($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS])){
throw new \SYSTEM\LOG\ERROR("Given class is not a cronjob");}
//time
return \SYSTEM\CRON\crontime::next_now( $cron[\SYSTEM\DBD\system_cron::FIELD_MIN],
$cron[\SYSTEM\DBD\system_cron::FIELD_HOUR],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY_WEEK],
$cron[\SYSTEM\DBD\system_cron::FIELD_MONTH]);
return \SYSTEM\CRON\crontime::next( strtotime($cron[\SYSTEM\DBD\system_cron::FIELD_LAST_RUN]),
$cron[\SYSTEM\DBD\system_cron::FIELD_MIN],
$cron[\SYSTEM\DBD\system_cron::FIELD_HOUR],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY],
$cron[\SYSTEM\DBD\system_cron::FIELD_DAY_WEEK],
$cron[\SYSTEM\DBD\system_cron::FIELD_MONTH]);
}
private static function status($class, $status){

View File

@ -20,6 +20,9 @@ class crontime {
$day_week = $day_week % 6; // 7 and 0 both mean Sunday
$now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday
$next_day += abs($day_week - $now_day_week);}
new \SYSTEM\LOG\INFO(print_r(array($base_time,$min,$hour,$day,$day_week,$month),true));
new \SYSTEM\LOG\INFO(print_r(array($now_min, $now_hour, $now_day, $now_month, $now_day_week),true));
new \SYSTEM\LOG\INFO(print_r(array($next_hour, $next_min, 0, $next_month, $next_day, $next_year),true));
return mktime($next_hour, $next_min, 0, $next_month, $next_day, $next_year);
}
public static function last($base_time,$min,$hour,$day,$day_week,$month){