mirror of
https://github.com/moodle/moodle.git
synced 2025-05-31 21:19:49 +02:00
MDL-27233 move the restorer enrol/ra creation to the very beginning of the restore process
Some early steps in restore are using capability checks to decide how to restore some information. But at that stage, if the course contents have been removed and the user had perms at course level only (usually teacher) the process can fail because some content is not restoreable due to the lack of permissions. Moving the restorer step to the beginning really helps is those situations and it does not hurt at all. Also, fixed one notice detected when testing this.
This commit is contained in:
parent
2afaf485cf
commit
ede7105fd9
@ -74,9 +74,6 @@ class restore_course_task extends restore_task {
|
||||
$this->add_step(new restore_enrolments_structure_step('course_enrolments', 'enrolments.xml'));
|
||||
}
|
||||
|
||||
// Now make sure the user that is running the restore can actually access the course
|
||||
$this->add_step(new restore_fix_restorer_access_step('fix_restorer_access'));
|
||||
|
||||
// Restore course filters (conditionally)
|
||||
if ($this->get_setting_value('filters')) {
|
||||
$this->add_step(new restore_filters_structure_step('course_filters', 'filters.xml'));
|
||||
|
@ -37,6 +37,10 @@ class restore_root_task extends restore_task {
|
||||
// Conditionally create the temp table (can exist from prechecks) and delete old stuff
|
||||
$this->add_step(new restore_create_and_clean_temp_stuff('create_and_clean_temp_stuff'));
|
||||
|
||||
// Now make sure the user that is running the restore can actually access the course
|
||||
// before executing any other step (potentially performing permission checks)
|
||||
$this->add_step(new restore_fix_restorer_access_step('fix_restorer_access'));
|
||||
|
||||
// If we haven't preloaded information, load all the included inforef records to temp_ids table
|
||||
$this->add_step(new restore_load_included_inforef_records('load_inforef_records'));
|
||||
|
||||
|
@ -1201,7 +1201,7 @@ abstract class restore_dbops {
|
||||
// With problems of type error, throw exception, shouldn't happen if prechecks were originally
|
||||
// executed, so be radical here.
|
||||
if (array_key_exists('errors', $problems)) {
|
||||
throw new restore_dbops_exception('restore_problems_processing_questions', null, implode(', ', $problems));
|
||||
throw new restore_dbops_exception('restore_problems_processing_questions', null, implode(', ', $problems['errors']));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user