]> git.mjollnir.org Git - moodle.git/commitdiff
Modified to delete temp files older than 4 hours (previously it was
authorstronk7 <stronk7>
Sun, 27 Jun 2004 22:35:27 +0000 (22:35 +0000)
committerstronk7 <stronk7>
Sun, 27 Jun 2004 22:35:27 +0000 (22:35 +0000)
configured to 48 hours). Force to execute the clean before doing the
backup itself. This should avoid the disk full of temp backup files
issue. See bug 1520.
http://moodle.org/bugs/bug.php?op=show&bugid=1520

Changes merged from MOODLE_13_STABLE.

backup/backup_scheduled.php
backup/lib.php
backup/restore_precheck.html

index 82397401ca6a7881bb63b10023b97a08219e93f0..e3896b3b7861c9f093c2ff425ca8cdd53b61f2b4 100644 (file)
@@ -479,14 +479,15 @@ function schedule_backup_course_execute($preferences,$starttime = 0) {
     //Create them as needed
     schedule_backup_log($starttime,$preferences->backup_course,"    checking temp structures");
     $status = check_and_create_backup_dir($preferences->backup_unique_code);
-    //Empty dir
+    //Empty backup dir
     if ($status) {
-        schedule_backup_log($starttime,$preferences->backup_course,"    cleaning old data");
+        schedule_backup_log($starttime,$preferences->backup_course,"    cleaning current dir");
         $status = clear_backup_dir($preferences->backup_unique_code);
     }
 
     //Delete old_entries from backup tables
     if ($status) {
+        schedule_backup_log($starttime,$preferences->backup_course,"    cleaning old data");
         $status = backup_delete_old_data();
     }
 
index ebddb96b0f350fe66da5b1cbc50e213aab2be15f..c76533585ff99f16f51983854ebd66e1af62cd5f 100644 (file)
     }
 
     //Delete old data in backup tables (if exists)
-    //Two days seems to be apropiate
+    //Four hours seem to be appropiate now that backup is stable
     function backup_delete_old_data() {
 
         global $CFG; 
 
         //Change this if you want !!
-        $days = 2;
+        $hours = 4;
         //End change this
-        $seconds = $days * 24 * 60 * 60;
+        $seconds = $hours * 60 * 60;
         $delete_from = time()-$seconds;
         //Now delete from tables
         $status = execute_sql("DELETE FROM {$CFG->prefix}backup_ids
index 015e00760cf862e941ce7037fc92a2b33eeb3fd6..72cfa5d8a7373153ee710777e100104272b1a8b1 100644 (file)
     $backup_unique_code = time();
     
     //Now check and create the backup dir (if it doesn't exist)
+    echo "<li>".get_string("creatingtemporarystructures");
     $status = check_and_create_backup_dir($backup_unique_code);
     //Empty dir
     if ($status) {
-        echo "<li>".get_string("creatingtemporarystructures");
         $status = clear_backup_dir($backup_unique_code);
     }