From: stronk7 Date: Mon, 1 May 2006 23:26:12 +0000 (+0000) Subject: Now, hidden courses that haven't been modified in the last month X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=10d89cf1d15c765149ae32d83ebb4eaa62b72d0e;p=moodle.git Now, hidden courses that haven't been modified in the last month are skipped by the scheduled backup. Credit goes to James. Bug 4694. (http://moodle.org/bugs/bug.php?op=show&bugid=4694) --- diff --git a/backup/backup_scheduled.php b/backup/backup_scheduled.php index 204b19b217..8111d62ef5 100644 --- a/backup/backup_scheduled.php +++ b/backup/backup_scheduled.php @@ -103,6 +103,13 @@ function schedule_backup_cron() { 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 @@ -154,6 +161,7 @@ function schedule_backup_cron() { $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 @@ -161,6 +169,7 @@ function schedule_backup_cron() { $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"; diff --git a/backup/log.php b/backup/log.php index d37cc4d633..8fa89ec10c 100644 --- a/backup/log.php +++ b/backup/log.php @@ -29,6 +29,7 @@ $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"); @@ -71,6 +72,8 @@ echo "".$strok.""; } else if ($course->laststatus == 2) { echo "".$strunfinished.""; + } else if ($course->laststatus == 3) { + echo "".$strskipped.""; } else { echo "".$strerror.""; }