Changes have been made to all built-in themes, to add the new popup navigation menu."; echo "
If you have customised themes, you will need to edit theme/xxxx/header.html as follows:"; echo "
See the standard themes for examples, eg: theme/standard/header.html";
print_simple_box_end();
}
if ($oldversion < 2002111200) {
execute_sql(" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` ");
}
if ($oldversion < 2002111400) {
// Rebuild all course caches, because some may not be done in new installs (eg site page)
if ($courses = get_records_sql("SELECT * FROM course")) {
require_once("$CFG->dirroot/course/lib.php");
foreach ($courses as $course) {
$modinfo = serialize(get_array_of_activities($course->id));
if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
notify("Could not cache module information for course '$course->fullname'!");
}
}
}
}
if ($oldversion < 2002112000) {
set_config("guestloginbutton", 1);
}
if ($oldversion < 2002122300) {
execute_sql("ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
}
if ($oldversion < 2002122700) {
if (! record_exists("log_display", "module", "user", "action", "view")) {
execute_sql("INSERT INTO {$CFG->prefix}log_display VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') ");
}
}
if ($oldversion < 2003010101) {
delete_records("log_display", "module", "user");
$new->module = "user";
$new->action = "view";
$new->mtable = "user";
$new->field = "CONCAT(firstname,\" \",lastname)";
insert_record("log_display", $new);
delete_records("log_display", "module", "course");
$new->module = "course";
$new->action = "view";
$new->mtable = "course";
$new->field = "fullname";
insert_record("log_display", $new);
$new->action = "update";
insert_record("log_display", $new);
$new->action = "enrol";
insert_record("log_display", $new);
}
if ($oldversion < 2003012200) {
// execute_sql(" ALTER TABLE `log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL ");
// Commented out - see below where it's done properly
}
if ($oldversion < 2003032500) {
modify_database("", "CREATE TABLE `prefix_user_coursecreators` (
`id` int(10) unsigned NOT NULL auto_increment,
`userid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM COMMENT='One record per course creator';");
}
if ($oldversion < 2003032602) {
// Redoing it because of no prefix last time
execute_sql(" ALTER TABLE `{$CFG->prefix}log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL ");
// Add some indexes for speed
execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(course) ");
execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(userid) ");
}
if ($oldversion < 2003041400) {
table_column("course_modules", "", "visible", "integer", "1", "unsigned", "1", "not null", "score");
}
if ($oldversion < 2003042104) { // Try to update permissions of all files
if ($files = get_directory_list($CFG->dataroot)) {
echo "Attempting to update permissions for all files... ignore any errors.";
foreach ($files as $file) {
echo "$CFG->dataroot/$file
";
@chmod("$CFG->dataroot/$file", $CFG->directorypermissions);
}
}
}
if ($oldversion < 2003042400) {
// Rebuild all course caches, because of changes to do with visible variable
if ($courses = get_records_sql("SELECT * FROM {$CFG->prefix}course")) {
require_once("$CFG->dirroot/course/lib.php");
foreach ($courses as $course) {
$modinfo = serialize(get_array_of_activities($course->id));
if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
notify("Could not cache module information for course '$course->fullname'!");
}
}
}
}
if ($oldversion < 2003042500) {
// Convert all usernames to lowercase.
$users = get_records_sql("SELECT id, username FROM {$CFG->prefix}user");
$cerrors = "";
$rarray = array();
foreach ($users as $user) { // Check for possible conflicts
$lcname = trim(moodle_strtolower($user->username));
if (in_array($lcname, $rarray)) {
$cerrors .= $user->id."->".$lcname.'
' ;
} else {
array_push($rarray,$lcname);
}
}
if ($cerrors != '') {
notify("Error: Cannot convert usernames to lowercase.
Following usernames would overlap (id->username):
$cerrors .
Please resolve overlapping errors.");
$result = false;
}
$cerrors = "";
echo "Checking userdatabase:
";
foreach ($users as $user) {
$lcname = trim(moodle_strtolower($user->username));
if ($lcname != $user->username) {
$convert = set_field("user" , "username" , $lcname, "id", $user->id);
if (!$convert) {
if ($cerrors){
$cerrors .= ", ";
}
$cerrors .= $item;
} else {
echo ".";
}
}
}
if ($cerrors != '') {
notify("There were errors when converting following usernames to lowercase.
'$cerrors' . Sorry, but you will need to fix your database by hand.");
$result = false;
}
}
if ($oldversion < 2003042600) {
/// Some more indexes - we need all the help we can get on the logs
//execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(module) ");
//execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(action) ");
}
if ($oldversion < 2003042700) {
/// Changing to multiple indexes
execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX module ", false);
execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX action ", false);
execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX course ", false);
execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX userid ", false);
execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX coursemoduleaction (course,module,action) ");
execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX courseuserid (course,userid) ");
}
if ($oldversion < 2003042801) {
execute_sql("CREATE TABLE `{$CFG->prefix}course_display` (
`id` int(10) unsigned NOT NULL auto_increment,
`course` int(10) unsigned NOT NULL default '0',
`userid` int(10) unsigned NOT NULL default '0',
`display` int(10) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `courseuserid` (course,userid)
) TYPE=MyISAM COMMENT='Stores info about how to display the course'");
}
if ($oldversion < 2003050400) {
table_column("course_sections", "", "visible", "integer", "1", "unsigned", "1", "", "");
}
if ($oldversion < 2003050900) {
table_column("modules", "", "visible", "integer", "1", "unsigned", "1", "", "");
}
if ($oldversion < 2003050902) {
if (get_records("modules", "name", "pgassignment")) {
print_simple_box("Note: the pgassignment module has been removed (it will be replaced later by the workshop module). Go to the new 'Manage Modules' page and DELETE IT from your system", "center", "50%", "$THEME->cellheading", "20", "noticebox");
}
}
if ($oldversion < 2003051600) {
print_simple_box("Thanks for upgrading!
There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.", "center", "50%", "$THEME->cellheading", "20", "noticebox"); } if ($oldversion < 2003052300) { table_column("user", "", "autosubscribe", "integer", "1", "unsigned", "1", "", "htmleditor"); } if ($oldversion < 2003072100) { table_column("course", "", "visible", "integer", "1", "unsigned", "1", "", "marker"); } return $result; } ?>