if ($backup_course->nextstarttime > 0 && $backup_course->nextstarttime < $now) {
//We have to send a email because we have included at least one backup
$emailpending = true;
+ // Skip backup of unavailable courses that have remained unmodified in a month
+ if (!$course->visible && ($now - $course->timemodified) > 31) { //Hidden + unmodified last month
+ //if (!$course->visible && ($now - $course->timemodified) > 31*24*60*60) { //Hidden + unmodified last month
+ mtrace(" SKIPPING - hidden+unmodified");
+ set_field("backup_courses","laststatus","3","courseid",$backup_course->courseid);
+ continue;
+ }
//Only make the backup if laststatus isn't 2-UNFINISHED (uncontrolled error)
if ($backup_course->laststatus != 2) {
//Set laststarttime
$count_ok = count_records('backup_courses','laststatus','1');
$count_error = count_records('backup_courses','laststatus','0');
$count_unfinished = count_records('backup_courses','laststatus','2');
+ $count_skipped = count_records('backup_courses','laststatus','3');
//Build the message text
//Summary
$message .= "==================================================\n";
$message .= " ".get_string('courses').": ".$count_all."\n";
$message .= " ".get_string('ok').": ".$count_ok."\n";
+ $message .= " ".get_string('skipped').": ".$count_skipped."\n";
$message .= " ".get_string('error').": ".$count_error."\n";
$message .= " ".get_string('unfinished').": ".$count_unfinished."\n\n";
$strerror = get_string("error");
$strok = get_string("ok");
$strunfinished = get_string("unfinished");
+ $strskipped = get_string("skipped");
$strcourse = get_string("course");
$strtimetaken = get_string("timetaken","quiz");
$strstatus = get_string("status");
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strok."</font></td>";
} else if ($course->laststatus == 2) {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strunfinished."</font></td>";
+ } else if ($course->laststatus == 3) {
+ echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"green\">".$strskipped."</font></td>";
} else {
echo "<td nowrap=\"nowrap\" align=\"center\"><font size=\"2\" color=\"red\">".$strerror."</font></td>";
}