|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file keeps track of upgrades to 00004 // the choice 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_choice_upgrade($oldversion) { 00024 global $CFG, $DB; 00025 00026 $dbman = $DB->get_manager(); 00027 00028 //===== 1.9.0 upgrade line ======// 00029 00030 if ($oldversion < 2009042000) { 00031 00033 $table = new xmldb_table('choice'); 00034 $field = new xmldb_field('text', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name'); 00035 00037 $dbman->rename_field($table, $field, 'intro'); 00038 00040 upgrade_mod_savepoint(true, 2009042000, 'choice'); 00041 } 00042 00043 if ($oldversion < 2009042001) { 00044 00046 $table = new xmldb_table('choice'); 00047 $field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro'); 00048 00050 $dbman->rename_field($table, $field, 'introformat'); 00051 00053 upgrade_mod_savepoint(true, 2009042001, 'choice'); 00054 } 00055 00056 if ($oldversion < 2010101300) { 00057 00058 // Define field completionsubmit to be added to choice 00059 $table = new xmldb_table('choice'); 00060 $field = new xmldb_field('completionsubmit', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'timemodified'); 00061 00062 // Conditionally launch add field completionsubmit 00063 if (!$dbman->field_exists($table, $field)) { 00064 $dbman->add_field($table, $field); 00065 } 00066 00067 // choice savepoint reached 00068 upgrade_mod_savepoint(true, 2010101300, 'choice'); 00069 } 00070 00071 // Moodle v2.1.0 release upgrade line 00072 // Put any upgrade step following this 00073 00074 // Moodle v2.2.0 release upgrade line 00075 // Put any upgrade step following this 00076 00077 return true; 00078 } 00079 00080