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

index d13535e..e676344 100644 (file)
@@ -200,6 +200,18 @@ function xmldb_glossary_upgrade($oldversion) {
             $dbman->add_field($table, $field);
         }
 
+        // conditionally migrate to html format in intro
+        if ($CFG->texteditors !== 'textarea') {
+            $rs = $DB->get_recordset('glossary', array('introformat'=>FORMAT_MOODLE), '', 'id,intro,introformat');
+            foreach ($rs as $g) {
+                $g->intro       = text_to_html($g->intro, false, false, true);
+                $g->introformat = FORMAT_HTML;
+                $DB->update_record('glossary', $g);
+                upgrade_set_timeout();
+            }
+            $rs->close();
+        }
+
     /// glossary savepoint reached
         upgrade_mod_savepoint(true, 2009042006, 'glossary');
     }