MDL-23479 wiki restore code - correct encoding and time shifting

This commit is contained in:
Dan Marsden 2010-08-02 00:29:33 +00:00
parent 684784c81c
commit 26cf184c6f
2 changed files with 8 additions and 3 deletions

View File

@ -55,7 +55,8 @@ class restore_wiki_activity_task extends restore_activity_task {
$contents = array();
$contents[] = new restore_decode_content('wiki', array('intro'), 'wiki');
$contents[] = new restore_decode_content('wiki_versions', array('content'), 'wiki_version');
$contents[] = new restore_decode_content('wiki_pages', array('intro'), 'wiki_page');
return $contents;
}

View File

@ -59,6 +59,7 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st
$data->editbegin = $this->apply_date_offset($data->editbegin);
$data->editend = $this->apply_date_offset($data->editend);
$data->timemodified = $this->apply_date_offset($data->timemodified);
// insert the wiki record
$newitemid = $DB->insert_record('wiki', $data);
@ -86,6 +87,9 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st
$oldid = $data->id;
$data->subwikiid = $this->get_new_parentid('wiki_subwiki');
$data->userid = $this->get_mappingid('user', $data->userid);
$data->timemodified = $this->apply_date_offset($data->timemodified);
$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);
@ -97,10 +101,10 @@ class restore_wiki_activity_structure_step extends restore_activity_structure_st
$oldid = $data->id;
$data->pageid = $this->get_new_parentid('wiki_page');
$data->userid = $this->get_mappingid('user', $data->userid);
$data->timecreated = $this->apply_date_offset($data->timecreated);
$newitemid = $DB->insert_record('wiki_versions', $data);
// No need to save this mapping as far as nothing depend on it
// (child paths, file areas nor links decoder)
$this->set_mapping('wiki_version', $oldid, $newitemid);
}
protected function process_wiki_synonym($data) {
global $DB;