function reScheduleBypassed($conn) { if (!($rs =& $conn->Execute("SELECT crs.* FROM custom_report_scheduler crs, users usr WHERE crs.user=usr.login AND usr.enabled=1 AND usr.expires > '" . gmdate("Y-m-d H:i:s") . "' AND unix_timestamp(next_launch) < unix_timestamp()"))) { print $conn->ErrorMsg(); exit; } else { while (!$rs->EOF) { $schedule = array('type' => $rs->fields['schedule_type'], 'next_launch' => $rs->fields['next_launch']); $rid = $rs->fields['id']; $next_launch = updateNextLaunch($conn, $schedule, $rid); echo "\tRe-scheduling bypassed {$rid} from " . $rs->fields['next_launch'] . " to {$next_launch}\n"; $rs->MoveNext(); } } }
function reScheduleBypassed($conn) { $rs = $conn->Execute("SELECT crs.* FROM custom_report_scheduler crs, users usr WHERE crs.user=usr.login AND usr.enabled=1 AND usr.expires > '" . gmdate('Y-m-d H:i:s', gmdate('U')) . "' AND unix_timestamp(next_launch) < unix_timestamp('" . gmdate('Y-m-d H:i:s', gmdate('U')) . "') AND next_launch <> '0000-00-00 00:00:00'"); if (!$rs) { print $conn->ErrorMsg(); exit; } else { while (!$rs->EOF) { $schedule = array('type' => $rs->fields['schedule_type'], 'next_launch' => $rs->fields['next_launch']); // Reprogramme "Run Once" passed report if ('O' === $schedule['type']) { $schedule['type'] = 'OR'; } $rid = $rs->fields['id']; $next_launch = updateNextLaunch($conn, $schedule, $rid); echo "\tRe-scheduling bypassed {$rid} from " . $rs->fields['next_launch'] . " to {$next_launch}\n"; $rs->MoveNext(); } } }
$text = _('Searching scheduled reports') . "...\n"; $to_text .= sprintf("\n%s", $text); echo $to_text; $i = 0; foreach ($report_list as $k => $value) { $run = checkTimeExecute($value['next_launch']); if ($run) { $i++; $scheduled_reports[$k] = $value; $text = _("Adding") . " " . $value['name_report'] . " " . _("to scheduled queue") . '...'; $to_text = sprintf("\n\t%s", $text); echo $to_text; // Update next launch $schedule = array('type' => $value['schedule_type'], 'next_launch' => $value['next_launch'], 'data' => unserialize($value['schedule'])); $current_launch = $value['next_launch']; $next_launch = updateNextLaunch($conn, $schedule, $value['id']); if ($next_launch === false) { $text = _('Failed to update the next launch: ') . ($to_text = sprintf("\n\t%s", $text)); $scheduled_reports[$k]['current_launch'] = ""; } else { $next_launch_txt = $next_launch == '0000-00-00 00:00:00' ? "-" : $next_launch; $text = _('Next launch: ') . $next_launch_txt; $to_text = sprintf("\n\t%s\n", $text); $scheduled_reports[$k]['current_launch'] = $current_launch; } echo $to_text; } } if ($i == 0) { $text = _("No reports found"); $to_text = sprintf("\n\t%s\n\n", $text);