Merge branch 'MDL-35146_master' of https://github.com/markn86/moodle

This commit is contained in:
Damyon Wiese 2013-11-04 11:53:40 +08:00
commit 42fb49ae0b

View File

@ -70,20 +70,34 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st
protected function process_wiki_subwiki($data) {
global $DB;
$data = (object)$data;
$data = (object) $data;
$oldid = $data->id;
$data->wikiid = $this->get_new_parentid('wiki');
$data->groupid = $this->get_mappingid('group', $data->groupid);
$data->userid = $this->get_mappingid('user', $data->userid);
$newitemid = $DB->insert_record('wiki_subwikis', $data);
// If the groupid is not equal to zero, get the mapping for the group.
if ((int) $data->groupid !== 0) {
$data->groupid = $this->get_mappingid('group', $data->groupid);
}
// If the userid is not equal to zero, get the mapping for the user.
if ((int) $data->userid !== 0) {
$data->userid = $this->get_mappingid('user', $data->userid);
}
// If these values are not equal to false then a mapping was successfully made.
if ($data->groupid !== false && $data->userid !== false) {
$newitemid = $DB->insert_record('wiki_subwikis', $data);
} else {
$newitemid = false;
}
$this->set_mapping('wiki_subwiki', $oldid, $newitemid);
}
protected function process_wiki_page($data) {
global $DB;
$data = (object)$data;
$data = (object) $data;
$oldid = $data->id;
$data->subwikiid = $this->get_new_parentid('wiki_subwiki');
$data->userid = $this->get_mappingid('user', $data->userid);
@ -91,9 +105,16 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st
$data->timecreated = $this->apply_date_offset($data->timecreated);
$data->timerendered = $this->apply_date_offset($data->timerendered);
$newitemid = $DB->insert_record('wiki_pages', $data);
$this->set_mapping('wiki_page', $oldid, $newitemid, true); // There are files related to this
// Check that we were able to get a parentid for this page.
if ($data->subwikiid !== false) {
$newitemid = $DB->insert_record('wiki_pages', $data);
} else {
$newitemid = false;
}
$this->set_mapping('wiki_page', $oldid, $newitemid, true);
}
protected function process_wiki_version($data) {
global $DB;