// Regular: nextRun is in the past and +frequency is in the future
// Late: nextRun is so much behind that +frequency is still in the past. Calculate nextRun for the future with respect to the given shedule/frequency (skip lost past actions)
// Do the calculation with MySQL to stay in the MySQL date/time calculation world.
$sql="SELECT c.id, c.type, c.content, c.frequency, c.nextRun FROM Cron AS c WHERE c.status='enable' AND c.nextRun < NOW() AND c.nextRun!=0 AND c.inProgress=0";
$jobs=$this->db->sql($sql);
// Iterate over all AutoCron Jobs
foreach($jobsas$job){
// Start progress counter
$this->db->sql("UPDATE Cron SET inProgress=NOW() WHERE id=? LIMIT 1",ROW_REGULAR,[$job[COLUMN_ID]]);