mirror of
https://github.com/moodle/moodle.git
synced 2025-02-08 09:02:07 +01:00
MDL-22179 backup - ensure we have the old/new courseid mapping available always
This commit is contained in:
parent
cfea745e41
commit
d90e49f238
@ -47,6 +47,11 @@ class restore_create_and_clean_temp_stuff extends restore_execution_step {
|
||||
$itemid = $this->task->get_old_system_contextid();
|
||||
$newitemid = get_context_instance(CONTEXT_SYSTEM)->id;
|
||||
restore_dbops::set_backup_ids_record($this->get_restoreid(), 'context', $itemid, $newitemid);
|
||||
// Create the old-course-id to new-course-id mapping, we need that available since the beginning
|
||||
$itemid = $this->task->get_old_courseid();
|
||||
$newitemid = $this->get_courseid();
|
||||
restore_dbops::set_backup_ids_record($this->get_restoreid(), 'course', $itemid, $newitemid);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -950,9 +955,6 @@ class restore_course_structure_step extends restore_structure_step {
|
||||
// Course record ready, update it
|
||||
$DB->update_record('course', $data);
|
||||
|
||||
// Set course mapping
|
||||
$this->set_mapping('course', $oldid, $data->id);
|
||||
|
||||
// Course tags
|
||||
if (!empty($CFG->usetags) && isset($coursetags)) { // if enabled in server and present in backup
|
||||
$tags = array();
|
||||
|
@ -83,6 +83,10 @@ abstract class restore_task extends base_task {
|
||||
return $this->plan->get_tempdir();
|
||||
}
|
||||
|
||||
public function get_old_courseid() {
|
||||
return $this->plan->get_info()->original_course_id;
|
||||
}
|
||||
|
||||
public function get_old_contextid() {
|
||||
return $this->plan->get_info()->original_course_contextid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user