Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Misc changes to improve performance on a brand-new installation

  • Loading branch information...
commit ef58b82265ae35b6efdbb7dbb4b1f0bc9ba98eb4 1 parent 3b9af3d
martin authored
View
6 admin/index.php
@@ -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 {
View
5 admin/user.php
@@ -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)");
View
2  course/edit.html
@@ -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>
View
2  course/editsection.php
@@ -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");
View
8 course/lib.php
@@ -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") {
View
5 course/loggraph.php
@@ -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) {
View
4 course/mod.php
@@ -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");
View
7 mod/forum/db/mysql.sql
@@ -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',
Please sign in to comment.
Something went wrong with that request. Please try again.