MDL-10107 Fixed the definition of message providers ... it now works through files...
[moodle.git] / mod / lesson / db / upgrade.php
CommitLineData
b8a342d7 1<?php //$Id$
2
3// This file keeps track of upgrades to
4// the lesson module
5//
6// Sometimes, changes between versions involve
7// alterations to database structures and other
8// major things that may break installations.
9//
10// The upgrade function in this file will attempt
11// to perform all the necessary actions to upgrade
12// your older installtion to the current version.
13//
14// If there's something it cannot do itself, it
15// will tell you what you need to do.
16//
17// The commands in here will all be database-neutral,
b1f93b15 18// using the methods of database_manager class
b8a342d7 19
20function xmldb_lesson_upgrade($oldversion=0) {
21
f33e1ed4 22 global $CFG, $THEME, $DB;
b8a342d7 23
f33e1ed4 24 $dbman = $DB->get_manager();
7a8137e9 25
f33e1ed4 26 $result = true;
ff99f91a 27
f33e1ed4 28//===== 1.9.0 upgrade line ======//
92bcca38 29
01291265 30 if ($result && $oldversion < 2007072201) {
31
a8cb94f6 32 $table = new xmldb_table('lesson');
33 $field = new xmldb_field('usegrademax');
34 $field2 = new xmldb_field('usemaxgrade');
01291265 35
36 /// Rename lesson->usegrademax to lesson->usemaxgrade. Some old sites can have it incorrect. MDL-13177
f33e1ed4 37 if ($dbman->field_exists($table, $field) && !$dbman->field_exists($table, $field2)) {
01291265 38 /// Set field specs
69b80cc2 39 $field->set_attributes(XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, null, null, '0', 'ongoing');
01291265 40 /// Launch rename field usegrademax to usemaxgrade
eee5d9bb 41 $dbman->rename_field($table, $field, 'usemaxgrade');
01291265 42 }
04264aed 43
44 upgrade_mod_savepoint($result, 2007072201, 'lesson');
01291265 45 }
3b120e46 46
b8a342d7 47 return $result;
48}
49
50?>