Skip to content

Commit

Permalink
fixed recursive backing up of backup folder when resource diretory re…
Browse files Browse the repository at this point in the history
…ference is course files root - MDL-6280
  • Loading branch information
skodak committed Sep 16, 2006
1 parent 383df89 commit 8621846
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mod/resource/backuplib.php
Expand Up @@ -145,10 +145,16 @@ function resource_backup_files($bf,$preferences,$resource) {
$newbit .= $bits[$i].'/';
$status = $status && check_dir_exists($CFG->dataroot.'/temp/backup/'.$preferences->backup_unique_code.'/course_files/'.$newbit,true);
}

$status = $status && backup_copy_file($CFG->dataroot."/".$preferences->backup_course."/".$resource->reference,
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/course_files/".$resource->reference);

if ($resource->reference === '') {
$status = $status && backup_copy_course_files($preferences); // copy while ignoring backupdata and moddata!!!
} else if (strpos($resource->reference, 'backupdata') === 0 or strpos($resource->reference, $CFG->moddata) === 0) {
// no copying - these directories must not be shared anyway!
} else {
$status = $status && backup_copy_file($CFG->dataroot."/".$preferences->backup_course."/".$resource->reference,
$CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/course_files/".$resource->reference);
}

// now, just in case we check moddata ( going forwards, resources should use this )
$status = $status && check_and_create_moddata_dir($preferences->backup_unique_code);
$status = $status && check_dir_exists($CFG->dataroot."/temp/backup/".$preferences->backup_unique_code."/".$CFG->moddata."/resource/",true);
Expand Down

0 comments on commit 8621846

Please sign in to comment.