config.php and remove all the unused settings (except the database, URL and directory definitions). See config-dist.php for an example of how your new slim config.php should look."); } if ($oldversion < 2002092000) { execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL "); } if ($oldversion < 2002092100) { execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` "); } if ($oldversion < 2002101001) { execute_sql(" ALTER TABLE `user` ADD `htmleditor` TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL AFTER `maildisplay` "); } if ($oldversion < 2002101701) { execute_sql(" ALTER TABLE `reading` RENAME `resource` "); // Small line with big consequences! execute_sql(" DELETE FROM `log_display` WHERE module = 'reading'"); execute_sql(" INSERT INTO log_display VALUES ('resource', 'view', 'resource', 'name') "); execute_sql(" UPDATE log SET module = 'resource' WHERE module = 'reading' "); execute_sql(" UPDATE modules SET name = 'resource' WHERE name = 'reading' "); } if ($oldversion < 2002102503) { require_once("$CFG->dirroot/mod/forum/lib.php"); require_once("$CFG->dirroot/course/lib.php"); if (! $module = get_record("modules", "name", "forum")) { notify("Could not find forum module!!"); return false; } // First upgrade the site forums if ($site = get_site()) { print_heading("Making News forums editable for main site (moving to section 1)..."); if ($news = forum_get_course_forum($site->id, "news")) { $mod->course = $site->id; $mod->module = $module->id; $mod->instance = $news->id; $mod->section = 1; if (! $mod->coursemodule = add_course_module($mod) ) { notify("Could not add a new course module to the site"); return false; } if (! $sectionid = add_mod_to_section($mod) ) { notify("Could not add the new course module to that section"); return false; } if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) { notify("Could not update the course module with the correct section"); return false; } } } // Now upgrade the courses. if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0")) { print_heading("Making News and Social forums editable for each course (moving to section 0)..."); foreach ($courses as $course) { if ($course->format == "social") { // we won't touch them continue; } if ($news = forum_get_course_forum($course->id, "news")) { $mod->course = $course->id; $mod->module = $module->id; $mod->instance = $news->id; $mod->section = 0; if (! $mod->coursemodule = add_course_module($mod) ) { notify("Could not add a new course module to the course '$course->fullname'"); return false; } if (! $sectionid = add_mod_to_section($mod) ) { notify("Could not add the new course module to that section"); return false; } if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) { notify("Could not update the course module with the correct section"); return false; } } if ($social = forum_get_course_forum($course->id, "social")) { $mod->course = $course->id; $mod->module = $module->id; $mod->instance = $social->id; $mod->section = 0; if (! $mod->coursemodule = add_course_module($mod) ) { notify("Could not add a new course module to the course '$course->fullname'"); return false; } if (! $sectionid = add_mod_to_section($mod) ) { notify("Could not add the new course module to that section"); return false; } if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) { notify("Could not update the course module with the correct section"); return false; } } } } } if ($oldversion < 2002111003) { execute_sql(" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` "); 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 < 2002111100) { print_simple_box_start("CENTER", "", "#FFCCCC"); echo ""; echo "

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 "

"; 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 "); } 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';"); } return true; } ?>