create_new_user() can now import other fields from an external source
[moodle.git] / version.php
CommitLineData
cbd1170e 1<?PHP //$Id$
2// This file keeps track of upgrades to Moodle.
3//
4// Sometimes, changes between versions involve
5// alterations to database structures and other
6// major things that may break installations.
7//
8// This file specifies the current version of
9// Moodle installed, which can be compared against
10// a previous version (see the "config" table).
11//
c646b70d 12// To do this, visit the "admin" page or the site
13// home page while logged in as an admin.
cbd1170e 14//
15// The upgrade function in this file will attempt
16// to perform all the necessary actions to upgrade
17// your older databases to the current version.
18// If there's something it cannot do itself, it
19// will tell you what you need to do.
20
168fe142 21$version = 2002100200; // The current version is a date (YYYYMMDDXX) where
c646b70d 22 // XX is a number that increments during the day
23
168fe142 24$release = "1.0.6 dev"; // For humans only, not used for the upgrade process
cbd1170e 25
a8876884 26function upgrade_moodle($oldversion=0) {
cbd1170e 27
a8876884 28 if ($oldversion == 0) {
29 execute_sql("
30 CREATE TABLE `config` (
31 `id` int(10) unsigned NOT NULL auto_increment,
32 `name` varchar(255) NOT NULL default '',
33 `value` varchar(255) NOT NULL default '',
34 PRIMARY KEY (`id`),
35 UNIQUE KEY `name` (`name`)
501cdbd8 36 ) COMMENT='Moodle configuration variables';");
a8876884 37 notify("Created a new table 'config' to hold configuration data");
38 }
501cdbd8 39 if ($oldversion < 2002073100) {
7363ff91 40 execute_sql(" DELETE FROM `modules` WHERE `name` = 'chat' ");
a8876884 41 }
7ea53a1f 42 if ($oldversion < 2002080200) {
43 execute_sql(" ALTER TABLE `modules` DROP `fullname` ");
44 execute_sql(" ALTER TABLE `modules` DROP `search` ");
45 }
565f7a95 46 if ($oldversion < 2002080300) {
7363ff91 47 execute_sql(" ALTER TABLE `log_display` CHANGE `table` `mtable` VARCHAR( 20 ) NOT NULL ");
48 execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 3 ) DEFAULT '3' NOT NULL ");
49 }
7363ff91 50 if ($oldversion < 2002082100) {
51 execute_sql(" ALTER TABLE `course` CHANGE `guest` `guest` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL ");
565f7a95 52 }
55e078c0 53 if ($oldversion < 2002082101) {
7b1c0ce3 54 execute_sql(" ALTER TABLE `user` ADD `maildisplay` TINYINT(2) UNSIGNED DEFAULT '2' NOT NULL AFTER `mailformat` ");
55 }
56 if ($oldversion < 2002090100) {
57 execute_sql(" ALTER TABLE `course_sections` CHANGE `summary` `summary` TEXT NOT NULL ");
55e078c0 58 }
b4d7002e 59 if ($oldversion < 2002090701) {
60 execute_sql(" ALTER TABLE `user_teachers` CHANGE `authority` `authority` TINYINT( 10 ) DEFAULT '3' NOT NULL ");
61 execute_sql(" ALTER TABLE `user_teachers` ADD `role` VARCHAR(40) NOT NULL AFTER `authority` ");
62 }
b4d7002e 63 if ($oldversion < 2002090800) {
64 execute_sql(" ALTER TABLE `course` ADD `teachers` VARCHAR( 100 ) DEFAULT 'Teachers' NOT NULL AFTER `teacher` ");
65 execute_sql(" ALTER TABLE `course` ADD `students` VARCHAR( 100 ) DEFAULT 'Students' NOT NULL AFTER `student` ");
66 }
a789fb73 67 if ($oldversion < 2002091000) {
68 execute_sql(" ALTER TABLE `user` CHANGE `personality` `secret` VARCHAR( 15 ) DEFAULT NULL ");
69 }
1a72314d 70 if ($oldversion < 2002091400) {
71 execute_sql(" ALTER TABLE `user` ADD `lang` VARCHAR( 3 ) DEFAULT 'en' NOT NULL AFTER `country` ");
72 }
74944b73 73 if ($oldversion < 2002091900) {
74 notify("Most Moodle configuration variables have been moved to the database and can now be edited via the admin page.");
75 notify("Although it is not vital that you do so, you might want to edit <U>config.php</U> and remove all the unused settings (except the database, URL and directory definitions). See <U>config-dist.php</U> for an example of how your new slim config.php should look.");
76 }
93e0f85d 77 if ($oldversion < 2002092000) {
78 execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL ");
79 }
bb09fb11 80 if ($oldversion < 2002092100) {
81 execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` ");
82 }
b4d7002e 83
cbd1170e 84 return true;
85}
86
87?>