MDL-21250 capital letters removal and greylisted string removal
[moodle.git] / mod / label / db / upgrade.php
blob8bc211066ff5e7276c4df59ea59649574d86f2d0
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Label module upgrade
21 * @package mod
22 * @subpackage label
23 * @copyright 2006 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 // This file keeps track of upgrades to
28 // the label module
30 // Sometimes, changes between versions involve
31 // alterations to database structures and other
32 // major things that may break installations.
34 // The upgrade function in this file will attempt
35 // to perform all the necessary actions to upgrade
36 // your older installation to the current version.
38 // If there's something it cannot do itself, it
39 // will tell you what you need to do.
41 // The commands in here will all be database-neutral,
42 // using the methods of database_manager class
44 // Please do not forget to use upgrade_set_timeout()
45 // before any action that may take longer time to finish.
47 defined('MOODLE_INTERNAL') || die;
49 function xmldb_label_upgrade($oldversion) {
50 global $CFG, $DB;
52 $dbman = $DB->get_manager();
54 //===== 1.9.0 upgrade line ======//
56 if ($oldversion < 2009042200) {
58 /// Rename field content on table label to intro
59 $table = new xmldb_table('label');
60 $field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
62 /// Launch rename field content
63 $dbman->rename_field($table, $field, 'intro');
65 /// label savepoint reached
66 upgrade_mod_savepoint(true, 2009042200, 'label');
69 if ($oldversion < 2009042201) {
71 /// Define field introformat to be added to label
72 $table = new xmldb_table('label');
73 $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0', 'intro');
75 /// Launch add field introformat
76 $dbman->add_field($table, $field);
78 // all existing lables in 1.9 are in HTML format
79 $DB->set_field('label', 'introformat', FORMAT_HTML, array());
81 /// label savepoint reached
82 upgrade_mod_savepoint(true, 2009042201, 'label');
85 return true;