Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/label/db/upgrade.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00027 // This file keeps track of upgrades to
00028 // the label module
00029 //
00030 // Sometimes, changes between versions involve
00031 // alterations to database structures and other
00032 // major things that may break installations.
00033 //
00034 // The upgrade function in this file will attempt
00035 // to perform all the necessary actions to upgrade
00036 // your older installation to the current version.
00037 //
00038 // If there's something it cannot do itself, it
00039 // will tell you what you need to do.
00040 //
00041 // The commands in here will all be database-neutral,
00042 // using the methods of database_manager class
00043 //
00044 // Please do not forget to use upgrade_set_timeout()
00045 // before any action that may take longer time to finish.
00046 
00047 defined('MOODLE_INTERNAL') || die;
00048 
00049 function xmldb_label_upgrade($oldversion) {
00050     global $CFG, $DB;
00051 
00052     $dbman = $DB->get_manager();
00053 
00054 //===== 1.9.0 upgrade line ======//
00055 
00056     if ($oldversion < 2009042200) {
00057 
00059         $table = new xmldb_table('label');
00060         $field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
00061 
00063         $dbman->rename_field($table, $field, 'intro');
00064 
00066         upgrade_mod_savepoint(true, 2009042200, 'label');
00067     }
00068 
00069     if ($oldversion < 2009042201) {
00070 
00072         $table = new xmldb_table('label');
00073         $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0', 'intro');
00074 
00076         $dbman->add_field($table, $field);
00077 
00078         // all existing lables in 1.9 are in HTML format
00079         $DB->set_field('label', 'introformat', FORMAT_HTML, array());
00080 
00082         upgrade_mod_savepoint(true, 2009042201, 'label');
00083     }
00084 
00085     // Moodle v2.1.0 release upgrade line
00086     // Put any upgrade step following this
00087 
00088     // Moodle v2.2.0 release upgrade line
00089     // Put any upgrade step following this
00090 
00091     return true;
00092 }
00093 
00094 
 All Data Structures Namespaces Files Functions Variables Enumerations