MDL-82220 group: check valid mapping when restoring custom fields.
This commit is contained in:
@@ -1235,9 +1235,11 @@ class restore_groups_structure_step extends restore_structure_step {
|
||||
*/
|
||||
public function process_groupcustomfield($data) {
|
||||
$newgroup = $this->get_mapping('group', $data['groupid']);
|
||||
$data['groupid'] = $newgroup->newitemid ?? $data['groupid'];
|
||||
$handler = \core_group\customfield\group_handler::create();
|
||||
$handler->restore_instance_data_from_backup($this->task, $data);
|
||||
if ($newgroup && $newgroup->newitemid) {
|
||||
$data['groupid'] = $newgroup->newitemid;
|
||||
$handler = \core_group\customfield\group_handler::create();
|
||||
$handler->restore_instance_data_from_backup($this->task, $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function process_grouping($data) {
|
||||
@@ -1291,10 +1293,12 @@ class restore_groups_structure_step extends restore_structure_step {
|
||||
* @return void
|
||||
*/
|
||||
public function process_groupingcustomfield($data) {
|
||||
$newgroup = $this->get_mapping('grouping', $data['groupingid']);
|
||||
$data['groupingid'] = $newgroup->newitemid ?? $data['groupingid'];
|
||||
$handler = \core_group\customfield\grouping_handler::create();
|
||||
$handler->restore_instance_data_from_backup($this->task, $data);
|
||||
$newgrouping = $this->get_mapping('grouping', $data['groupingid']);
|
||||
if ($newgrouping && $newgrouping->newitemid) {
|
||||
$data['groupingid'] = $newgrouping->newitemid;
|
||||
$handler = \core_group\customfield\grouping_handler::create();
|
||||
$handler->restore_instance_data_from_backup($this->task, $data);
|
||||
}
|
||||
}
|
||||
|
||||
public function process_grouping_group($data) {
|
||||
|
||||
Reference in New Issue
Block a user