From: stronk7 Date: Sun, 27 Jun 2004 22:35:27 +0000 (+0000) Subject: Modified to delete temp files older than 4 hours (previously it was X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dfd0229026cb6a8e7ee263a202956ce24efdfe26;p=moodle.git Modified to delete temp files older than 4 hours (previously it was 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. --- diff --git a/backup/backup_scheduled.php b/backup/backup_scheduled.php index 82397401ca..e3896b3b78 100644 --- a/backup/backup_scheduled.php +++ b/backup/backup_scheduled.php @@ -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(); } diff --git a/backup/lib.php b/backup/lib.php index ebddb96b0f..c76533585f 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -25,15 +25,15 @@ } //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 diff --git a/backup/restore_precheck.html b/backup/restore_precheck.html index 015e00760c..72cfa5d8a7 100644 --- a/backup/restore_precheck.html +++ b/backup/restore_precheck.html @@ -52,10 +52,10 @@ $backup_unique_code = time(); //Now check and create the backup dir (if it doesn't exist) + echo "
  • ".get_string("creatingtemporarystructures"); $status = check_and_create_backup_dir($backup_unique_code); //Empty dir if ($status) { - echo "
  • ".get_string("creatingtemporarystructures"); $status = clear_backup_dir($backup_unique_code); }