|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file keeps track of upgrades to 00004 // the survey module 00005 // 00006 // Sometimes, changes between versions involve 00007 // alterations to database structures and other 00008 // major things that may break installations. 00009 // 00010 // The upgrade function in this file will attempt 00011 // to perform all the necessary actions to upgrade 00012 // your older installation to the current version. 00013 // 00014 // If there's something it cannot do itself, it 00015 // will tell you what you need to do. 00016 // 00017 // The commands in here will all be database-neutral, 00018 // using the methods of database_manager class 00019 // 00020 // Please do not forget to use upgrade_set_timeout() 00021 // before any action that may take longer time to finish. 00022 00023 function xmldb_survey_upgrade($oldversion) { 00024 global $CFG, $DB; 00025 00026 $dbman = $DB->get_manager(); 00027 00028 //===== 1.9.0 upgrade line ======// 00029 00030 if ($oldversion < 2009042002) { 00031 00033 $table = new xmldb_table('survey'); 00034 $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro'); 00035 00037 if (!$dbman->field_exists($table, $field)) { 00038 $dbman->add_field($table, $field); 00039 } 00040 00041 // conditionally migrate to html format in intro 00042 if ($CFG->texteditors !== 'textarea') { 00043 $rs = $DB->get_recordset('survey', array('introformat'=>FORMAT_MOODLE), '', 'id,intro,introformat'); 00044 foreach ($rs as $s) { 00045 $s->intro = text_to_html($s->intro, false, false, true); 00046 $s->introformat = FORMAT_HTML; 00047 $DB->update_record('survey', $s); 00048 upgrade_set_timeout(); 00049 } 00050 $rs->close(); 00051 } 00052 00054 upgrade_mod_savepoint(true, 2009042002, 'survey'); 00055 } 00056 00057 // Moodle v2.1.0 release upgrade line 00058 // Put any upgrade step following this 00059 00060 // Moodle v2.2.0 release upgrade line 00061 // Put any upgrade step following this 00062 00063 return true; 00064 } 00065 00066