MDL-63798 mod_assign: fix restore when group is missing

This commit is contained in:
Davo Smith
2018-11-21 07:58:11 +00:00
parent 0225ad42ea
commit b5f63b1e90
@@ -167,6 +167,11 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
}
if (!empty($data->groupid)) {
$data->groupid = $this->get_mappingid('group', $data->groupid);
if (!$data->groupid) {
// If the group does not exist, then the submission cannot be viewed and restoring can
// violate the unique index on the submission table.
return;
}
} else {
$data->groupid = 0;
}