]> git.mjollnir.org Git - moodle.git/commitdiff
Now, hidden courses that haven't been modified in the last month
authorstronk7 <stronk7>
Mon, 1 May 2006 23:26:12 +0000 (23:26 +0000)
committerstronk7 <stronk7>
Mon, 1 May 2006 23:26:12 +0000 (23:26 +0000)
are skipped by the scheduled backup. Credit goes to James. Bug 4694.
(http://moodle.org/bugs/bug.php?op=show&bugid=4694)

backup/backup_scheduled.php
backup/log.php

index 204b19b2170578914f856b2a3dee4660d02c38c3..8111d62ef5e944d81d61be936cb67745aa876764 100644 (file)
@@ -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";
 
index d37cc4d6333e4871fe987058cc3e0ac6658f4b08..8fa89ec10c23b042d78659253cba17074086caa1 100644 (file)
@@ -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 "<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>";
                     }