From 41bac9d0af7235271bee91a7383b55fe8ab7e5ea Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 24 Sep 2004 11:51:12 +0000 Subject: [PATCH] The get_directory_list() function was being executed with directories excluded so backup_delete_old_dirs() was no working fine! This should delete REALLY old dirs in sites with problems in their scheduled backup. Merged from MOODLE_14_STABLE --- backup/backuplib.php | 10 ++++++---- backup/lib.php | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index e842d48152..8015e9a12d 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1,4 +1,4 @@ -dataroot."/users"; //Check if directory exists if (is_dir($rootdir)) { - $coursedirs = get_directory_list($rootdir); - foreach ($coursedirs as $dir) { + //Get directories without descend + $userdirs = get_directory_list($rootdir,"",false,true,false); + foreach ($userdirs as $dir) { //Extracts user id from file path $tok = strtok($dir,"/"); if ($tok) { @@ -313,7 +314,8 @@ $rootdir = $CFG->dataroot."/$course"; //Check if directory exists if (is_dir($rootdir)) { - $coursedirs = get_directory_list($rootdir,$CFG->moddata); + //Get files and directories without descend + $coursedirs = get_directory_list($rootdir,$CFG->moddata,false,true,true); $backupdata_dir = "backupdata"; foreach ($coursedirs as $dir) { //Check it isn't backupdata_dir diff --git a/backup/lib.php b/backup/lib.php index ab63a1597d..5fcbf1cace 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -58,7 +58,8 @@ global $CFG; $status = true; - $list = get_directory_list($CFG->dataroot."/temp/backup", "", false); + //Get files and directories in the temp backup dir witout descend + $list = get_directory_list($CFG->dataroot."/temp/backup", "", false, true, true); foreach ($list as $file) { $file_path = $CFG->dataroot."/temp/backup/".$file; $moddate = filemtime($file_path); -- 2.39.5