mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-23993 backup - enforce in UI and save all backup files with .mbz
This commit is contained in:
parent
11d6233451
commit
12c80f79b4
@ -92,10 +92,10 @@ class backup_final_task extends backup_task {
|
||||
// to the backup, settings, license, versions and other useful information
|
||||
$this->add_step(new backup_main_structure_step('mainfile', 'moodle_backup.xml'));
|
||||
|
||||
// Generate the zip file
|
||||
// Generate the zip file (mbz extension)
|
||||
$this->add_step(new backup_zip_contents('zip_contents'));
|
||||
|
||||
// Copy the generated zip file to final destination
|
||||
// Copy the generated zip (.mbz) file to final destination
|
||||
$this->add_step(new backup_store_backup_file('save_backupfile'));
|
||||
|
||||
// Clean the temp dir (conditionally) and drop temp table
|
||||
|
@ -48,8 +48,8 @@ class backup_root_task extends backup_task {
|
||||
protected function define_settings() {
|
||||
|
||||
// Define filename setting
|
||||
$filename = new backup_filename_setting('filename', base_setting::IS_FILENAME, 'backup.zip');
|
||||
$filename->set_ui(get_string('filename', 'backup'), 'backup.zip', array('size'=>50));
|
||||
$filename = new backup_filename_setting('filename', base_setting::IS_FILENAME, 'backup.mbz');
|
||||
$filename->set_ui(get_string('filename', 'backup'), 'backup.mbz', array('size'=>50));
|
||||
$this->add_setting($filename);
|
||||
|
||||
// Define users setting (keeping it on hand to define dependencies)
|
||||
|
@ -1299,7 +1299,7 @@ class backup_main_structure_step extends backup_structure_step {
|
||||
}
|
||||
|
||||
/**
|
||||
* Execution step that will generate the final zip file with all the contents
|
||||
* Execution step that will generate the final zip (.mbz) file with all the contents
|
||||
*/
|
||||
class backup_zip_contents extends backup_execution_step {
|
||||
|
||||
@ -1321,8 +1321,8 @@ class backup_zip_contents extends backup_execution_step {
|
||||
$files['moodle_backup.log'] = $logfilepath;
|
||||
}
|
||||
|
||||
// Calculate the zip fullpath (in OS temp area it's always backup.zip)
|
||||
$zipfile = $basepath . '/backup.zip';
|
||||
// Calculate the zip fullpath (in OS temp area it's always backup.mbz)
|
||||
$zipfile = $basepath . '/backup.mbz';
|
||||
|
||||
// Get the zip packer
|
||||
$zippacker = get_file_packer('application/zip');
|
||||
@ -1342,8 +1342,8 @@ class backup_store_backup_file extends backup_execution_step {
|
||||
// Get basepath
|
||||
$basepath = $this->get_basepath();
|
||||
|
||||
// Calculate the zip fullpath (in OS temp area it's always backup.zip)
|
||||
$zipfile = $basepath . '/backup.zip';
|
||||
// Calculate the zip fullpath (in OS temp area it's always backup.mbz)
|
||||
$zipfile = $basepath . '/backup.mbz';
|
||||
|
||||
// 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));
|
||||
|
@ -138,7 +138,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
* Returns the default backup filename, based in passed params.
|
||||
*
|
||||
* Default format is (see MDL-22145)
|
||||
* backup word - format - type - name - date - info . zip
|
||||
* backup word - format - type - name - date - info . mbz
|
||||
* where name is variable (course shortname, section name/id, activity modulename + cmid)
|
||||
* and info can be (nu = no user info, an = anonymized)
|
||||
*/
|
||||
@ -182,7 +182,7 @@ abstract class backup_plan_dbops extends backup_dbops {
|
||||
}
|
||||
|
||||
return $backupword . '-' . $format . '-' . $type . '-' .
|
||||
$name . '-' . $date . $info . '.zip';
|
||||
$name . '-' . $date . $info . '.mbz';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ class backup_confirmation_form extends backup_moodleform {
|
||||
if (!array_key_exists('setting_root_filename', $errors)) {
|
||||
if (trim($data['setting_root_filename']) == '') {
|
||||
$errors['setting_root_filename'] = get_string('errorfilenamerequired', 'backup');
|
||||
} else if (!preg_match('#\.zip$#i', $data['setting_root_filename'])) {
|
||||
} else if (!preg_match('#\.mbz$#i', $data['setting_root_filename'])) {
|
||||
$errors['setting_root_filename'] = get_string('errorfilenamemustbezip', 'backup');
|
||||
}
|
||||
}
|
||||
|
@ -330,7 +330,7 @@ class backup_ui_stage_confirmation extends backup_ui_stage {
|
||||
foreach ($this->ui->get_tasks() as $task) {
|
||||
if ($setting = $task->get_setting('filename')) {
|
||||
$form->add_heading('filenamesetting', get_string('filename', 'backup'));
|
||||
if ($setting->get_value() == 'backup.zip') {
|
||||
if ($setting->get_value() == 'backup.mbz') {
|
||||
$format = $this->ui->get_format();
|
||||
$type = $this->ui->get_type();
|
||||
$id = $this->ui->get_controller_id();
|
||||
|
@ -77,7 +77,7 @@ $string['currentstage8'] = 'Perform backup';
|
||||
$string['currentstage16'] = 'Complete';
|
||||
$string['dependenciesenforced'] = 'Your settings have been altered due to unmet dependencies';
|
||||
$string['errorfilenamerequired'] = 'You must enter a valid filename for this backup';
|
||||
$string['errorfilenamemustbezip'] = 'The filename you enter must be a ZIP file and have the .zip extension';
|
||||
$string['errorfilenamemustbezip'] = 'The filename you enter must be a ZIP file and have the .mbz extension';
|
||||
$string['errorminbackup20version'] = 'This backup file has been created with one development version of Moodle backup ({$a->backup}). Minimum required is {$a->min}. Cannot be restored.';
|
||||
$string['errorrestorefrontpage'] = 'Restoring over front page is not allowed.';
|
||||
$string['executionsuccess'] = 'The backup file was successfully created.';
|
||||
|
Loading…
x
Reference in New Issue
Block a user