MDL-23204 convert text to html in folder intro
authorPetr Skoda <skodak@moodle.org>
Fri, 16 Jul 2010 09:10:49 +0000 (09:10 +0000)
committerPetr Skoda <skodak@moodle.org>
Fri, 16 Jul 2010 09:10:49 +0000 (09:10 +0000)
mod/folder/db/upgradelib.php

index 6c39bf2..3092d8a 100644 (file)
@@ -57,11 +57,19 @@ function folder_20_migrate() {
         $directory = '/'.trim($candidate->reference, '/').'/';
         $directory = str_replace('//', '/', $directory);
 
         $directory = '/'.trim($candidate->reference, '/').'/';
         $directory = str_replace('//', '/', $directory);
 
+        if ($CFG->texteditors !== 'textarea') {
+            $intro       = text_to_html($candidate->intro, false, false, true);
+            $introformat = FORMAT_HTML;
+        } else {
+            $intro       = $candidate->intro;
+            $introformat = FORMAT_MOODLE;
+        }
+
         $folder = new object();
         $folder->course       = $candidate->course;
         $folder->name         = $candidate->name;
         $folder = new object();
         $folder->course       = $candidate->course;
         $folder->name         = $candidate->name;
-        $folder->intro        = $candidate->intro;
-        $folder->introformat  = $candidate->introformat;
+        $folder->intro        = $intro;
+        $folder->introformat  = $introformat;
         $folder->revision     = 1;
         $folder->timemodified = time();
 
         $folder->revision     = 1;
         $folder->timemodified = time();