MDL-23628 removed more log_display upgrade leftovers
[moodle.git] / mod / label / db / upgrade.php
CommitLineData
86342d63 1<?php
b8a342d7 2
9516942a
PS
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.
14//
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/>.
17
18/**
19 * Label module upgrade
20 *
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
25 */
26
86342d63 27// This file keeps track of upgrades to
b8a342d7 28// the label module
29//
30// Sometimes, changes between versions involve
31// alterations to database structures and other
32// major things that may break installations.
33//
34// The upgrade function in this file will attempt
35// to perform all the necessary actions to upgrade
2e0406a5 36// your older installation to the current version.
b8a342d7 37//
38// If there's something it cannot do itself, it
39// will tell you what you need to do.
40//
41// The commands in here will all be database-neutral,
b1f93b15 42// using the methods of database_manager class
775f811a 43//
44// Please do not forget to use upgrade_set_timeout()
45// before any action that may take longer time to finish.
b8a342d7 46
9516942a
PS
47defined('MOODLE_INTERNAL') || die;
48
775f811a 49function xmldb_label_upgrade($oldversion) {
50 global $CFG, $DB;
b8a342d7 51
775f811a 52 $dbman = $DB->get_manager();
b8a342d7 53
219f652b 54//===== 1.9.0 upgrade line ======//
775f811a 55
a4cdd6d2 56 if ($oldversion < 2009042200) {
43b44d5e 57
58 /// Rename field content on table label to intro
59 $table = new xmldb_table('label');
2a88f626 60 $field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
43b44d5e 61
62 /// Launch rename field content
63 $dbman->rename_field($table, $field, 'intro');
64
65 /// label savepoint reached
a4cdd6d2 66 upgrade_mod_savepoint(true, 2009042200, 'label');
43b44d5e 67 }
68
a4cdd6d2 69 if ($oldversion < 2009042201) {
43b44d5e 70
71 /// Define field introformat to be added to label
72 $table = new xmldb_table('label');
fe8ce24a 73 $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0', 'intro');
43b44d5e 74
75 /// Launch add field introformat
76 $dbman->add_field($table, $field);
77
d4dfc6e6
PS
78 // all existing lables in 1.9 are in HTML format
79 $DB->set_field('label', 'introformat', FORMAT_HTML, array());
fe8ce24a 80
81 /// label savepoint reached
d4dfc6e6 82 upgrade_mod_savepoint(true, 2009042201, 'label');
fe8ce24a 83 }
84
a4cdd6d2 85 return true;
b8a342d7 86}
87
86342d63 88