]> git.mjollnir.org Git - moodle.git/commitdiff
Misc changes to improve performance on a brand-new installation
authormartin <martin>
Thu, 1 Aug 2002 15:48:27 +0000 (15:48 +0000)
committermartin <martin>
Thu, 1 Aug 2002 15:48:27 +0000 (15:48 +0000)
admin/index.php
admin/user.php
course/edit.html
course/editsection.php
course/lib.php
course/loggraph.php
course/mod.php
mod/forum/db/mysql.sql

index 711753e8266f30dba1d3540c2a1c5a6d10e1dfd9..bef0699778e791557bb8985db32e377938f0bca8 100644 (file)
@@ -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>");
                 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 {
index 56853008b44fd087b593a6af1fddf845df0cd607..996e687e2d48ebbc9a4622171288ede3f45bc9d2 100644 (file)
             $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)");
index 8cc7758afb941fa26f6f302a60f7653da3a57ccd..9ed0f07e58cb2340fff048a65f6013213a885b30 100644 (file)
@@ -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>
index b06a24e713836facf0ce33f2677f4fe083d8cbf3..a4649c6f9429dc91ab4263e23191777bce306f8d 100644 (file)
@@ -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");
 
index 97e160fc2de7782486793fbabe5f97cd91e41be9..b3d3e3a4013a01657b315fa93901f3f83c2c35c2 100644 (file)
@@ -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") {
 
index 8913d3d41bd04bf0536b706850dfd9211b24ccad..6b375c28960001a4d10bee64de6779282bc14bfd 100644 (file)
     $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) {
index d392d1f4c8ae88c57ede93c483a757145ee4c149..929e987bc383589720d6c8a47955680236acb93b 100644 (file)
             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");
             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");
index 0eec2429e0fd1e300754d2c5a61a5759dde05418..6f01478163c2cc61b88d4acce1c9c32b10cc28cb 100644 (file)
@@ -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',