mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Misc changes to improve performance on a brand-new installation
This commit is contained in:
parent
3b9af3dd6f
commit
ef58b82265
@ -9,7 +9,7 @@
|
||||
|
||||
// Check databases and modules and install as needed.
|
||||
if (! $db->Metatables() ) {
|
||||
print_header("Setting up database", "Setting up database", "Setting up databases for the first time", "");
|
||||
print_header("Setting up database", "Setting up database", "Setting up databases for the first time");
|
||||
|
||||
if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
|
||||
$db->debug = true;
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
if ($dversion = get_field("config", "value", "name", "version")) {
|
||||
if ($version > $dversion) { // upgrade
|
||||
print_header("Upgrading database", "Upgrading database", "Upgrading main databases");
|
||||
notify("Upgrading databases from version $dversion to $version...");
|
||||
$db->debug=true;
|
||||
if (upgrade_moodle($dversion)) {
|
||||
@ -56,6 +57,7 @@
|
||||
} else {
|
||||
$dversion->name = "version";
|
||||
$dversion->value = $version;
|
||||
print_header("Upgrading database", "Upgrading database", "Upgrading main databases");
|
||||
if (insert_record("config", $dversion)) {
|
||||
notify("You are currently using Moodle version $version");
|
||||
print_heading("<A HREF=\"index.php\">Continue</A>");
|
||||
@ -125,7 +127,9 @@
|
||||
print_header("Setting up database", "Setting up database", "Setting up module tables", "");
|
||||
}
|
||||
$updated_modules = true;
|
||||
$db->debug = true;
|
||||
if (modify_database("$fullmod/db/$CFG->dbtype.sql")) {
|
||||
$db->debug = false;
|
||||
if ($module->id = insert_record("modules", $module)) {
|
||||
notify("$module->name tables have been set up correctly");
|
||||
} else {
|
||||
|
@ -149,6 +149,11 @@
|
||||
$usernew->timemodified = time();
|
||||
|
||||
if (update_record("user", $usernew)) {
|
||||
if ($usernew->id == $USER->id) { // Reload admin
|
||||
$USER = get_user_info_from_db("id", $usernew->id);
|
||||
$USER->loggedin = true;
|
||||
set_moodle_cookie($USER->username);
|
||||
}
|
||||
redirect("index.php", "Changes saved");
|
||||
} else {
|
||||
error("Could not update the user record ($user->id)");
|
||||
|
@ -43,7 +43,7 @@
|
||||
<tr valign=top>
|
||||
<td><P><? print_string("format") ?>:</td>
|
||||
<td><?
|
||||
choose_from_menu ($FORMATS, "format", "$form->format");
|
||||
choose_from_menu ($COURSE_FORMATS, "format", "$form->format");
|
||||
formerr($err["format"]);
|
||||
?>
|
||||
</td>
|
||||
|
@ -42,7 +42,7 @@
|
||||
$form = $section;
|
||||
}
|
||||
|
||||
$sectionname = $SECTION[$course->format];
|
||||
$sectionname = $COURSE_SECTION[$course->format];
|
||||
|
||||
print_header("Edit $sectionname $section->section", "Edit $sectionname $section->section", "", "form.summary");
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
<? // $Id$
|
||||
|
||||
$MAXNEWSDISPLAY = 4;
|
||||
|
||||
$FORMATS = array (
|
||||
$COURSE_FORMATS = array (
|
||||
"weeks" => "Weekly layout",
|
||||
"social" => "Social layout",
|
||||
"topics" => "Topics layout"
|
||||
);
|
||||
|
||||
$SECTION = array (
|
||||
$COURSE_SECTION = array (
|
||||
"weeks" => "week",
|
||||
"social" => "section",
|
||||
"topics" => "topic"
|
||||
);
|
||||
|
||||
$COURSE_MAX_LOG_DISPLAY = 150; // days
|
||||
|
||||
|
||||
function print_log_selector_form($course, $selecteduser=0, $selecteddate="today") {
|
||||
|
||||
|
@ -31,9 +31,12 @@
|
||||
$timenow = time();
|
||||
|
||||
switch ($type) {
|
||||
|
||||
case "usercourse.png":
|
||||
|
||||
$COURSE_MAX_LOG_DISPLAY = $COURSE_MAX_LOG_DISPLAY * 3600 * 24; // seconds
|
||||
if ($timenow - $course->startdate > $COURSE_MAX_LOG_DISPLAY) {
|
||||
$course->startdate = $timenow - $COURSE_MAX_LOG_DISPLAY;
|
||||
}
|
||||
$timestart = usergetmidnight($course->startdate);
|
||||
$i = 0;
|
||||
while ($timestart < $timenow) {
|
||||
|
@ -147,7 +147,7 @@
|
||||
error("This module doesn't exist");
|
||||
}
|
||||
|
||||
$sectionname = $SECTION[$course->format];
|
||||
$sectionname = $COURSE_SECTION[$course->format];
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
error("The required instance of this module doesn't exist");
|
||||
@ -182,7 +182,7 @@
|
||||
error("This course doesn't exist");
|
||||
}
|
||||
|
||||
$sectionname = $SECTION[$course->format];
|
||||
$sectionname = $COURSE_SECTION[$course->format];
|
||||
|
||||
if (! $module = get_record("modules", "name", $add)) {
|
||||
error("This module type doesn't exist");
|
||||
|
@ -5,11 +5,12 @@
|
||||
CREATE TABLE forum (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
course int(10) unsigned NOT NULL default '0',
|
||||
type enum('discussion','news','general','social','eachuser','teacher') NOT NULL default 'general',
|
||||
type enum('single','news','general','social','eachuser','teacher') NOT NULL default 'general',
|
||||
name varchar(255) NOT NULL default '',
|
||||
intro mediumtext NOT NULL,
|
||||
intro text NOT NULL,
|
||||
open tinyint(1) unsigned NOT NULL default '0',
|
||||
assessed tinyint(1) unsigned NOT NULL default '0',
|
||||
forcesubscribe tinyint(1) unsigned NOT NULL default '0',
|
||||
timemodified int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY id (id)
|
||||
@ -38,7 +39,7 @@ CREATE TABLE forum_discussions (
|
||||
|
||||
CREATE TABLE forum_posts (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
discuss int(10) unsigned NOT NULL default '0',
|
||||
discussion int(10) unsigned NOT NULL default '0',
|
||||
parent int(10) unsigned NOT NULL default '0',
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
created int(10) unsigned NOT NULL default '0',
|
||||
|
Loading…
x
Reference in New Issue
Block a user