Permalink
Browse files

MDL-12403 backup: Ability to exclude question bank

Now users can choose to exclude the question bank from the backup,
this will in turn prevent any modules which use the question bank
from being included in the backup.
  • Loading branch information...
danpoltawski committed Sep 19, 2013
1 parent b07ef13 commit f68fc38867e4c0a701e06fb5a0443f7038b7a7aa
@@ -246,6 +246,8 @@ public function get_setting($name) {
* Defines the common setting that any backup activity will have
*/
protected function define_settings() {
global $CFG;
require_once($CFG->libdir.'/questionlib.php');
// All the settings related to this activity will include this prefix
$settingprefix = $this->modulename . '_' . $this->moduleid . '_';
@@ -264,6 +266,12 @@ protected function define_settings() {
// Look for "activities" root setting
$activities = $this->plan->get_setting('activities');
$activities->add_dependency($activity_included);
if (question_module_uses_questions($this->modulename)) {
$questionbank = $this->plan->get_setting('questionbank');
$questionbank->add_dependency($activity_included);
}
// Look for "section_included" section setting (if exists)
$settingname = 'section_' . $this->sectionid . '_included';
if ($this->plan->setting_exists($settingname)) {
@@ -90,8 +90,10 @@ public function build() {
// course->defaultgroupingid
$this->add_step(new backup_annotate_groups_from_groupings('annotate_groups_from_groupings'));
// Annotate the question_categories belonging to the course context
$this->add_step(new backup_calculate_question_categories('course_question_categories'));
// Annotate the question_categories belonging to the course context (conditionally).
if ($this->get_setting_value('questionbank')) {
$this->add_step(new backup_calculate_question_categories('course_question_categories'));
}
// Generate the roles file (optionally role assignments and always role overrides)
$this->add_step(new backup_roles_structure_step('course_roles', 'roles.xml'));
@@ -152,5 +152,10 @@ protected function define_settings() {
$gradehistories->set_ui(new backup_setting_ui_checkbox($gradehistories, get_string('rootsettinggradehistories', 'backup')));
$this->add_setting($gradehistories);
$users->add_dependency($gradehistories);
// Define question bank inclusion setting.
$questionbank = new backup_generic_setting('questionbank', base_setting::IS_BOOLEAN, true);
$questionbank->set_ui(new backup_setting_ui_checkbox($questionbank, get_string('rootsettingquestionbank', 'backup')));
$this->add_setting($questionbank);
}
}
View
@@ -226,6 +226,7 @@
$string['rootsettingcomments'] = 'Include comments';
$string['rootsettingcalendarevents'] = 'Include calendar events';
$string['rootsettinguserscompletion'] = 'Include user completion details';
$string['rootsettingquestionbank'] = 'Include question bank';
$string['rootsettinglogs'] = 'Include course logs';
$string['rootsettinggradehistories'] = 'Include grade history';
$string['rootsettingimscc1'] = 'Convert to IMS Common Cartridge 1.0';

0 comments on commit f68fc38

Please sign in to comment.