MDL-34629 wiki: convert default format value during restore
authorCharles Fulton <mackensen@gmail.com>
Sat, 28 Jul 2012 21:22:44 +0000 (17:22 -0400)
committerDan Poltawski <dan@moodle.com>
Mon, 6 Aug 2012 06:19:45 +0000 (14:19 +0800)
mod/wiki/backup/moodle1/lib.php

index 199f850..10cc4f7 100644 (file)
@@ -135,6 +135,8 @@ class moodle1_mod_wiki_handler extends moodle1_mod_handler {
      * data available
      */
     public function process_wiki($data) {
+        global $CFG;    // We need to check a config setting.
+
         if (!empty($data['initialcontent'])) {
             //convert file in <INITIALCONTENT>filename</INITIALCONTENT> into a subwiki page if no entry created.
             $temppath = $this->converter->get_tempdir_path();
@@ -168,6 +170,12 @@ class moodle1_mod_wiki_handler extends moodle1_mod_handler {
         $this->fileman->itemid   = 0;
         $data['intro'] = moodle1_converter::migrate_referenced_files($data['intro'], $this->fileman);
 
+        // convert the introformat if necessary
+        if ($CFG->texteditors !== 'textarea') {
+            $data['intro'] = text_to_html($data['intro'], false, false, true);
+            $data['introformat'] = FORMAT_HTML;
+        }
+
         // we now have all information needed to start writing into the file
         $this->open_xml_writer("activities/wiki_{$this->moduleid}/wiki.xml");
         $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid,