MDL-55356 backup: Check setting exists before checking value

This commit is contained in:
Andrew Nicols
2017-10-12 11:37:05 +08:00
parent e61ad18e70
commit afc8d59c35
3 changed files with 18 additions and 12 deletions
@@ -183,10 +183,12 @@ abstract class restore_activity_task extends restore_task {
$this->add_step(new restore_activity_competencies_structure_step('activity_competencies', 'competencies.xml'));
// Search reindexing, if enabled and if not restoring entire course.
if (\core_search\manager::is_indexing_enabled() &&
!($this->get_target() == backup::TARGET_NEW_COURSE ||
$this->get_setting_value('overwrite_conf'))) {
$this->add_step(new restore_activity_search_index('activity_search_index'));
if (\core_search\manager::is_indexing_enabled()) {
$wholecourse = $this->get_target() == backup::TARGET_NEW_COURSE;
$wholecourse = $wholecourse || ($this->setting_exists('overwrite_conf') && $this->get_setting_value('overwrite_conf'));
if (!$wholecourse) {
$this->add_step(new restore_activity_search_index('activity_search_index'));
}
}
// At the end, mark it as built
+6 -4
View File
@@ -99,10 +99,12 @@ abstract class restore_block_task extends restore_task {
}
// Search reindexing (if enabled).
if (\core_search\manager::is_indexing_enabled() &&
!($this->get_target() == backup::TARGET_NEW_COURSE ||
$this->get_setting_value('overwrite_conf'))) {
$this->add_step(new restore_block_search_index('block_search_index'));
if (\core_search\manager::is_indexing_enabled()) {
$wholecourse = $this->get_target() == backup::TARGET_NEW_COURSE;
$wholecourse = $wholecourse || $this->setting_exists('overwrite_conf') && $this->get_setting_value('overwrite_conf');
if (!$required) {
$this->add_step(new restore_block_search_index('block_search_index'));
}
}
// At the end, mark it as built
+6 -4
View File
@@ -115,10 +115,12 @@ class restore_final_task extends restore_task {
$this->add_step(new restore_drop_and_clean_temp_stuff('drop_and_clean_temp_stuff'));
// If restoring to a new course or overwriting config, reindex the whole course.
if (\core_search\manager::is_indexing_enabled() &&
($this->get_target() == backup::TARGET_NEW_COURSE ||
$this->get_setting_value('overwrite_conf'))) {
$this->add_step(new restore_course_search_index('course_search_index'));
if (\core_search\manager::is_indexing_enabled()) {
$wholecourse = $this->get_target() == backup::TARGET_NEW_COURSE;
$wholecourse = $wholecourse || $this->setting_exists('overwrite_conf') && $this->get_setting_value('overwrite_conf');
if ($wholecourse) {
$this->add_step(new restore_course_search_index('course_search_index'));
}
}
$this->built = true;