Commit 2c3d8a06 authored by Damyon Wiese's avatar Damyon Wiese
Browse files

Merge branch 'MDL-60669-master' of git://github.com/tobiasreischmann/moodle

parents bdb15765 9bd68076
......@@ -168,8 +168,14 @@ class restore_forum_activity_structure_step extends restore_activity_structure_s
$data->forum = $this->get_new_parentid('forum');
$data->userid = $this->get_mappingid('user', $data->userid);
$newitemid = $DB->insert_record('forum_subscriptions', $data);
$this->set_mapping('forum_subscription', $oldid, $newitemid, true);
// Create only a new subscription if it does not already exist (see MDL-59854).
if ($subscription = $DB->get_record('forum_subscriptions',
array('forum' => $data->forum, 'userid' => $data->userid))) {
$this->set_mapping('forum_subscription', $oldid, $subscription->id, true);
} else {
$newitemid = $DB->insert_record('forum_subscriptions', $data);
$this->set_mapping('forum_subscription', $oldid, $newitemid, true);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment