NOBUG backup - on OS temp area, use backup.zip. When storing, rename to utf-8 name
authorEloy Lafuente <stronk7@moodle.org>
Sun, 2 May 2010 00:19:51 +0000 (00:19 +0000)
committerEloy Lafuente <stronk7@moodle.org>
Sun, 2 May 2010 00:19:51 +0000 (00:19 +0000)
backup/moodle2/backup_stepslib.php
backup/util/helper/backup_helper.class.php

index fe80f3f..c9b834f 100644 (file)
@@ -1096,8 +1096,8 @@ class backup_zip_contents extends backup_execution_step {
              $files['moodle_backup.log'] = $logfilepath;
         }
 
-        // Calculate the zip fullpath
-        $zipfile = $basepath . '/' . $this->get_setting_value('filename');
+        // Calculate the zip fullpath (in OS temp area it's always backup.zip)
+        $zipfile = $basepath . '/backup.zip';
 
         // Get the zip packer
         $zippacker = get_file_packer('application/zip');
@@ -1117,8 +1117,8 @@ class backup_store_backup_file extends backup_execution_step {
         // Get basepath
         $basepath = $this->get_basepath();
 
-        // Calculate the zip fullpath
-        $zipfile = $basepath . '/' . $this->get_setting_value('filename');
+        // Calculate the zip fullpath (in OS temp area it's always backup.zip)
+        $zipfile = $basepath . '/backup.zip';
 
         // Perform storage and return it (TODO: shouldn't be array but proper result object)
         return array('backup_destination' => backup_helper::store_backup_file($this->get_backupid(), $zipfile));
index 2e44b7a..bd97896 100644 (file)
@@ -183,6 +183,7 @@ abstract class backup_helper {
         // Extract useful information to decide
         $hasusers  = (bool)$sinfo['users']->value;     // Backup has users
         $isannon   = (bool)$sinfo['anonymize']->value; // Backup is annonymzed
+        $filename  = $sinfo['filename']->value;        // Backup filename
         $backupmode= $dinfo[0]->mode;                  // Backup mode backup::MODE_GENERAL/IMPORT/HUB
         $backuptype= $dinfo[0]->type;                  // Backup type backup::TYPE_1ACTIVITY/SECTION/COURSE
         $userid    = $dinfo[0]->userid;                // User->id executing the backup
@@ -241,7 +242,7 @@ abstract class backup_helper {
             'filearea'    => $filearea,
             'itemid'      => $itemid,
             'filepath'    => '/',
-            'filename'    => basename($filepath),
+            'filename'    => $filename,
             'userid'      => $userid,
             'timecreated' => time(),
             'timemodified'=> time());