version.php 2.14 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?PHP  //$Id$
// This file keeps track of upgrades to Moodle.
// 
// Sometimes, changes between versions involve 
// alterations to database structures and other 
// major things that may break installations.  
//
// This file specifies the current version of 
// Moodle installed, which can be compared against
// a previous version (see the "config" table).
//
// To do this, visit the "admin" page.
//
// The upgrade function in this file will attempt
// to perform all the necessary actions to upgrade
// your older databases to the current version.
// If there's something it cannot do itself, it 
// will tell you what you need to do.

martin's avatar
martin committed
20
$version = 2002090501;
21

22
function upgrade_moodle($oldversion=0) {
23

24
25
26
27
28
29
30
31
    if ($oldversion == 0) {
        execute_sql("
          CREATE TABLE `config` (
            `id` int(10) unsigned NOT NULL auto_increment,
            `name` varchar(255) NOT NULL default '',
            `value` varchar(255) NOT NULL default '',
            PRIMARY KEY  (`id`),
            UNIQUE KEY `name` (`name`)
32
          ) COMMENT='Moodle configuration variables';");
33
34
35
        notify("Created a new table 'config' to hold configuration data");
    }

36
    if ($oldversion < 2002073100) {
37
        execute_sql(" DELETE FROM `modules` WHERE `name` = 'chat' ");
38
    }
39

40
41
42
43
44
    if ($oldversion < 2002080200) {
        execute_sql(" ALTER TABLE `modules` DROP `fullname`  ");
        execute_sql(" ALTER TABLE `modules` DROP `search`  ");
    }

45
    if ($oldversion < 2002080300) {
46
47
48
49
50
51
        execute_sql(" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL ");
        execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL ");
    }

    if ($oldversion < 2002082100) {
        execute_sql(" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL ");
52
53
    }

54
    if ($oldversion < 2002082101) {
55
56
57
58
        execute_sql(" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` ");
    }
    if ($oldversion < 2002090100) {
        execute_sql(" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL ");
59
60
    }

61
62
63
64
    return true;
}

?>