From 37323148d933c89a125f661a00fcc3f27b9cc6d5 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 6 Nov 2008 07:17:34 +0000 Subject: [PATCH] backup: MDL-17145 And actually copy the backup file there! --- backup/backuplib.php | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index 54b9dddb2a..18cded66b6 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -2549,36 +2549,20 @@ //If $preferences->backup_destination isn't empty, then copy to custom directory if (!empty($preferences->backup_destination)) { $to_zip_file = $preferences->backup_destination."/".$preferences->backup_name; + + //Copy zip file + if ($status) { + $status = backup_copy_file ($from_zip_file,$to_zip_file); + } } else { //Define zip destination (course dir) - $to_zip_file = $CFG->dataroot."/".$preferences->backup_course; - - //echo "

From: ".$from_zip_file."
"; //Debug - - //echo "

Checking: ".$to_zip_file."
"; //Debug - - //Checks course dir exists - $status = check_dir_exists($to_zip_file,true); - - //Define zip destination (backup dir) - $to_zip_file = $to_zip_file."/backupdata"; - - //echo "

Checking: ".$to_zip_file."
"; //Debug - - //Checks backup dir exists - $status = check_dir_exists($to_zip_file,true); - - //Define zip destination (zip file) - $to_zip_file = $to_zip_file."/".$preferences->backup_name; + $context = get_context_instance(CONTEXT_COURSE, $preferences->backup_course); + $fs = get_file_storage(); + $file_record = array('contextid'=>$context->id, 'filearea'=>'course_backup', + 'itemid'=>0, 'filepath'=>'/', 'filename'=>$preferences->backup_name, + 'timecreated'=>time(), 'timemodified'=>time()); + $fs->create_file_from_pathname($file_record, $from_zip_file); } - - //echo "

To: ".$to_zip_file."
"; //Debug - - //Copy zip file - if ($status) { - $status = backup_copy_file ($from_zip_file,$to_zip_file); - } - return $status; } -- 2.39.5