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.
This commit is contained in:
stronk7 2004-06-27 22:35:27 +00:00
parent 3e93e0ce43
commit dfd0229026
3 changed files with 7 additions and 6 deletions

View 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();
}

View File

@ -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

View File

@ -52,10 +52,10 @@
$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);
}