From af478c0b2b980b85677414585f0593c207d87dc4 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 11 May 2003 22:17:56 +0000 Subject: [PATCH] Avoid counting files under get_string("backupdir") as course files --- backup/lib.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/backup/lib.php b/backup/lib.php index 860472ef551..52e022f5bf9 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -163,7 +163,7 @@ } //Calculate the number of course files to backup - //under $CFG->dataroot/$course, except $CFG->moddata + //under $CFG->dataroot/$course, except $CFG->moddata, and get_string("backupdir) //and put them (their path) in backup_ids //Return an array of info (name,value) function course_files_check_backup($course,$backup_unique_code) { @@ -175,11 +175,14 @@ if (is_dir($rootdir)) { $coursedirs = get_directory_list($rootdir,$CFG->moddata); foreach ($coursedirs as $dir) { - //Insert them into backup_files - $status = execute_sql("INSERT INTO {$CFG->prefix}backup_files - (backup_code, file_type, path) - VALUES - ('$backup_unique_code','course','$dir')",false); + //Check it isn't backupdir + if (dirname($dir) !== get_string("backupdir")) { + //Insert them into backup_files + $status = execute_sql("INSERT INTO {$CFG->prefix}backup_files + (backup_code, file_type, path) + VALUES + ('$backup_unique_code','course','$dir')",false); + } } } @@ -1081,10 +1084,10 @@ if (true) { //Now delete from tables $status = execute_sql("DELETE FROM {$CFG->prefix}backup_ids - WHERE backup_code < '$preferences->backup_unique_code'",false); + WHERE backup_code = '$preferences->backup_unique_code'",false); if ($status) { $status = execute_sql("DELETE FROM {$CFG->prefix}backup_files - WHERE backup_code < '$preferences->backup_unique_code'",false); + WHERE backup_code = '$preferences->backup_unique_code'",false); } //Now, delete temp directory (if exists) $file_path = $CFG->dataroot."/temp/backup/".$preferences->backup_unique_code;