Permalink
Browse files

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.
  • Loading branch information...
stronk7
stronk7 committed Sep 24, 2004
1 parent 78a0c06 commit e62064ad43d850e72f654595947119e3675f2ba5
Showing with 7 additions and 4 deletions.
  1. +5 −3 backup/backuplib.php
  2. +2 −1 backup/lib.php
View
@@ -261,8 +261,9 @@ function user_files_check_backup($course,$backup_unique_code) {
$rootdir = $CFG->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 @@ function course_files_check_backup($course,$backup_unique_code) {
$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
View
@@ -56,7 +56,8 @@ function backup_delete_old_dirs($delete_from) {
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);

0 comments on commit e62064a

Please sign in to comment.