MDL-21432 backup - fix for non-page comments (glossary...)

This commit is contained in:
Eloy Lafuente
2010-07-31 22:22:51 +00:00
parent 8d39cbb32b
commit 39aa0280e1
2 changed files with 13 additions and 4 deletions
@@ -196,6 +196,16 @@ abstract class restore_activity_task extends restore_task {
}
}
/**
* Given a commment area, return the itemname that contains the itemid mappings
*
* By default both are the same (commentarea = itemname), so return it. If some
* module uses a different approach, this method can be overriden in its taks
*/
public function get_comment_mapping_itemname($commentarea) {
return $commentarea;
}
/**
* Define (add) particular steps that each activity can have
*/
+3 -4
View File
@@ -872,13 +872,12 @@ class restore_comments_structure_step extends restore_structure_step {
// First of all, if the comment has some itemid, ask to the task what to map
$mapping = false;
$newitemid = 0;
if ($data->itemid) {
$mapping = $this->task->get_comment_mapping_itemname();
$newitemid = $this->get_mappingid($mapping, $data->itemid);
$mapping = $this->task->get_comment_mapping_itemname($data->commentarea);
$data->itemid = $this->get_mappingid($mapping, $data->itemid);
}
// Only restore the comment if has no mapping OR we have found the matching mapping
if (!$mapping || $newitemid) {
if (!$mapping || $data->itemid) {
// Only if user mapping and context
$data->userid = $this->get_mappingid('user', $data->userid);
if ($data->userid && $this->task->get_contextid()) {