mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-33756 backup: converters only available in general course backups.
This commit is contained in:
parent
f8dfdb524b
commit
936402278b
3 changed files with 28 additions and 21 deletions
|
@ -113,27 +113,27 @@ class backup_final_task extends backup_task {
|
|||
|
||||
require_once($CFG->dirroot . '/backup/util/helper/convert_helper.class.php');
|
||||
|
||||
//Checking if we have some converter involved in the process
|
||||
$converters = convert_helper::available_converters(false);
|
||||
//Conversion status
|
||||
// Look for converter steps only in type course and mode general backup operations.
|
||||
$conversion = false;
|
||||
foreach ($converters as $value) {
|
||||
if ($this->get_setting_value($value)) {
|
||||
//zip class
|
||||
$zip_contents = "{$value}_zip_contents";
|
||||
$store_backup_file = "{$value}_store_backup_file";
|
||||
$convert = "{$value}_backup_convert";
|
||||
if ($this->plan->get_type() == backup::TYPE_1COURSE and $this->plan->get_mode() == backup::MODE_GENERAL) {
|
||||
$converters = convert_helper::available_converters(false);
|
||||
foreach ($converters as $value) {
|
||||
if ($this->get_setting_value($value)) {
|
||||
// Zip class.
|
||||
$zip_contents = "{$value}_zip_contents";
|
||||
$store_backup_file = "{$value}_store_backup_file";
|
||||
$convert = "{$value}_backup_convert";
|
||||
|
||||
$this->add_step(new $convert("package_convert_{$value}"));
|
||||
$this->add_step(new $zip_contents("zip_contents_{$value}"));
|
||||
$this->add_step(new $store_backup_file("save_backupfile_{$value}"));
|
||||
if (!$conversion) {
|
||||
$conversion = true;
|
||||
$this->add_step(new $convert("package_convert_{$value}"));
|
||||
$this->add_step(new $zip_contents("zip_contents_{$value}"));
|
||||
$this->add_step(new $store_backup_file("save_backupfile_{$value}"));
|
||||
if (!$conversion) {
|
||||
$conversion = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// On backup::MODE_IMPORT, we don't have to zip nor store the the file, skip these steps
|
||||
if (($this->plan->get_mode() != backup::MODE_IMPORT) && !$conversion) {
|
||||
// Generate the zip file (mbz extension)
|
||||
|
|
|
@ -70,12 +70,15 @@ class backup_root_task extends backup_task {
|
|||
$filename->set_ui_filename(get_string('filename', 'backup'), 'backup.mbz', array('size'=>50));
|
||||
$this->add_setting($filename);
|
||||
|
||||
//Sample custom settings
|
||||
$converters = convert_helper::available_converters(false);
|
||||
foreach ($converters as $cnv) {
|
||||
$formatcnv = new backup_users_setting($cnv, base_setting::IS_BOOLEAN, false);
|
||||
$formatcnv->set_ui(new backup_setting_ui_checkbox($formatcnv, get_string('backupformat'.$cnv, 'backup')));
|
||||
$this->add_setting($formatcnv);
|
||||
// Present converter settings only in type course and mode general backup operations.
|
||||
$converters = array();
|
||||
if ($this->plan->get_type() == backup::TYPE_1COURSE and $this->plan->get_mode() == backup::MODE_GENERAL) {
|
||||
$converters = convert_helper::available_converters(false);
|
||||
foreach ($converters as $cnv) {
|
||||
$formatcnv = new backup_users_setting($cnv, base_setting::IS_BOOLEAN, false);
|
||||
$formatcnv->set_ui(new backup_setting_ui_checkbox($formatcnv, get_string('backupformat'.$cnv, 'backup')));
|
||||
$this->add_setting($formatcnv);
|
||||
}
|
||||
}
|
||||
|
||||
// Define users setting (keeping it on hand to define dependencies)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue