1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 18:04:43 +02:00

MDL-68702 core_backup: exclude legacy course files

This commit is contained in:
Nathan Nguyen 2020-05-13 17:08:23 +10:00
parent d4d798e684
commit 65c847d8fd
9 changed files with 43 additions and 5 deletions

@ -285,6 +285,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
$ADMIN->add('backups', $temp);
// Create a page for general import configuration and defaults.
@ -311,6 +314,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
new lang_string('configgeneralcontentbankcontent', 'backup'),
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
$ADMIN->add('backups', $temp);
@ -437,6 +443,10 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
1)
);
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), 1));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
@ -499,6 +509,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configrestorecontentbankcontent', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
// Restore defaults when merging into another course.
$temp->add(new admin_setting_heading('mergerestoredefaults', new lang_string('mergerestoredefaults', 'backup'), ''));

@ -184,5 +184,10 @@ class backup_root_task extends backup_task {
$contentbank = new backup_contentbankcontent_setting('contentbankcontent', base_setting::IS_BOOLEAN, true);
$contentbank->set_ui(new backup_setting_ui_checkbox($contentbank, get_string('rootsettingcontentbankcontent', 'backup')));
$this->add_setting($contentbank);
// Define legacy file inclusion setting.
$legacyfiles = new backup_generic_setting('legacyfiles', base_setting::IS_BOOLEAN, true);
$legacyfiles->set_ui(new backup_setting_ui_checkbox($legacyfiles, get_string('rootsettinglegacyfiles', 'backup')));
$this->add_setting($legacyfiles);
}
}

@ -488,7 +488,10 @@ class backup_course_structure_step extends backup_structure_step {
$course->annotate_files('course', 'summary', null);
$course->annotate_files('course', 'overviewfiles', null);
$course->annotate_files('course', 'legacy', null);
if ($this->get_setting_value('legacyfiles')) {
$course->annotate_files('course', 'legacy', null);
}
// Return root element ($course)

@ -76,7 +76,9 @@ class restore_course_task extends restore_task {
}
}
$this->add_step(new restore_course_legacy_files_step('legacy_files'));
if ($this->get_setting_value('legacyfiles')) {
$this->add_step(new restore_course_legacy_files_step('legacy_files'));
}
// Deal with enrolment methods and user enrolments.
if ($this->plan->get_mode() == backup::MODE_IMPORT) {

@ -302,5 +302,13 @@ class restore_root_task extends restore_task {
$contents->set_ui(new backup_setting_ui_checkbox($contents, get_string('rootsettingcontentbankcontent', 'backup')));
$contents->get_ui()->set_changeable($changeable);
$this->add_setting($contents);
// Include legacy files.
$defaultvalue = true;
$changeable = true;
$legacyfiles = new restore_generic_setting('legacyfiles', base_setting::IS_BOOLEAN, $defaultvalue);
$legacyfiles->set_ui(new backup_setting_ui_checkbox($legacyfiles, get_string('rootsettinglegacyfiles', 'backup')));
$legacyfiles->get_ui()->set_changeable($changeable);
$this->add_setting($legacyfiles);
}
}

@ -566,6 +566,7 @@ abstract class backup_controller_dbops extends backup_dbops {
'backup_general_groups' => 'groups',
'backup_general_competencies' => 'competencies',
'backup_general_contentbankcontent' => 'contentbankcontent',
'backup_general_legacyfiles' => 'legacyfiles'
);
self::apply_admin_config_defaults($controller, $settings, true);
break;
@ -580,6 +581,7 @@ abstract class backup_controller_dbops extends backup_dbops {
'backup_import_groups' => 'groups',
'backup_import_competencies' => 'competencies',
'backup_import_contentbankcontent' => 'contentbankcontent',
'backup_import_legacyfiles' => 'legacyfiles'
);
self::apply_admin_config_defaults($controller, $settings, true);
if ((!$controller->get_interactive()) &&
@ -611,7 +613,8 @@ abstract class backup_controller_dbops extends backup_dbops {
'backup_auto_questionbank' => 'questionbank',
'backup_auto_groups' => 'groups',
'backup_auto_competencies' => 'competencies',
'backup_auto_contentbankcontent' => 'contentbankcontent'
'backup_auto_contentbankcontent' => 'contentbankcontent',
'backup_auto_legacyfiles' => 'legacyfiles'
);
self::apply_admin_config_defaults($controller, $settings, false);
break;

@ -158,7 +158,8 @@ abstract class restore_controller_dbops extends restore_dbops {
'restore_general_questionbank' => 'questionbank',
'restore_general_groups' => 'groups',
'restore_general_competencies' => 'competencies',
'restore_general_contentbankcontent' => 'contentbankcontent'
'restore_general_contentbankcontent' => 'contentbankcontent',
'restore_general_legacyfiles' => 'legacyfiles'
);
self::apply_admin_config_defaults($controller, $settings, true);

@ -137,6 +137,7 @@ $string['configgeneralgroups'] = 'Sets the default for including groups and grou
$string['configgeneralroleassignments'] = 'If enabled by default roles assignments will also be backed up.';
$string['configgeneraluserscompletion'] = 'If enabled user completion information will be included in backups by default.';
$string['configgeneralusers'] = 'Sets the default for whether to include users in backups.';
$string['configlegacyfiles'] = 'If disabled, legacy course files will not be included';
$string['configloglifetime'] = 'This specifies the length of time you want to keep backup logs information. Logs that are older than this age are automatically deleted. It is recommended to keep this value small, because backup logged information can be huge.';
$string['configrestoreactivities'] = 'Sets the default for restoring activities.';
$string['configrestorebadges'] = 'Sets the default for restoring badges.';
@ -227,6 +228,7 @@ $string['generalfiles'] = 'Include files';
$string['generalfilters'] = 'Include filters';
$string['generalhistories'] = 'Include histories';
$string['generalgradehistories'] = 'Include histories';
$string['generallegacyfiles'] = 'Include legacy course files';
$string['generallogs'] = 'Include logs';
$string['generalquestionbank'] = 'Include question bank';
$string['generalgroups'] = 'Include groups and groupings';
@ -359,6 +361,7 @@ $string['rootsettingcalendarevents'] = 'Include calendar events';
$string['rootsettingcontentbankcontent'] = 'Include content bank content';
$string['rootsettinguserscompletion'] = 'Include user completion details';
$string['rootsettingquestionbank'] = 'Include question bank';
$string['rootsettinglegacyfiles'] = 'Include legacy course files';
$string['rootsettinglogs'] = 'Include course logs';
$string['rootsettinggradehistories'] = 'Include grade history';
$string['rootsettinggroups'] = 'Include groups and groupings';

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2021052500.12; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021052500.13; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev (Build: 20200910)'; // Human-friendly version name