]> git.mjollnir.org Git - moodle.git/commitdiff
fixed several bogus errors and warnings during installation and upgrades, forced...
authorskodak <skodak>
Sun, 10 Sep 2006 21:10:48 +0000 (21:10 +0000)
committerskodak <skodak>
Sun, 10 Sep 2006 21:10:48 +0000 (21:10 +0000)
admin/index.php
lib/setup.php

index 1b1f8c6d6c62907f2f76e552f13b974b95510049..153742bbaabfbc5810f50d53e4766bd3cb459ed0 100644 (file)
 
     $linktoscrolltoerrors = '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>';
     if (! $maintables) {
+    /// hide errors from headers in case debug enabled in config.php
+        $origdebug = $CFG->debug;
+        $CFG->debug = 5;
+        error_reporting($CFG->debug);
         if (empty($agreelicence)) {
             $strlicense = get_string("license");
             print_header($strlicense, $strlicense, $strlicense, "", "", false, "&nbsp;", "&nbsp;");
         $strdatabasesuccess  = get_string("databasesuccess");
         print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup,
                         "", $linktoscrolltoerrors, false, "&nbsp;", "&nbsp;");
+    /// return to original debugging level
+        $CFG->debug = $origdebug;
+        error_reporting($CFG->debug);
         upgrade_log_start();
         $db->debug = true;
 
             $a->newversion = "$release ($version)";
             $strdatabasechecking = get_string("databasechecking", "", $a);
 
+            // hide errors from headers in case debug is enabled
+            $origdebug = $CFG->debug;
+            $CFG->debug = 5;
+            error_reporting($CFG->debug);
+
+            // logout in case we are upgrading from pre 1.7 version - prevention of weird session problems
+            if ($CFG->version < 2006050600) {
+                require_logout();
+            }
+
             if (empty($confirmupgrade)) {
                 print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
                         "", "", false, "&nbsp;", "&nbsp;");
                 $strdatabasesuccess  = get_string("databasesuccess");
                 print_header($strdatabasechecking, $stradministration, $strdatabasechecking,
                         "", $linktoscrolltoerrors, false, "&nbsp;", "&nbsp;");
+            /// return to original debugging level
+                $CFG->debug = $origdebug;
+                error_reporting($CFG->debug);
                 upgrade_log_start();
                 print_heading($strdatabasechecking);
                 $db->debug=true;
index f5dbea1eec4b529e61cbe5398268f844436d5768..49758f8c1d5d5d5e06856d3156e984629a0a1967 100644 (file)
@@ -192,6 +192,14 @@ global $HTTPSPAGEREQUIRED;
 
     raise_memory_limit('64M');    // We should never NEED this much but just in case...
 
+/// Disable errors for now - needed for installation when debug enabled in config.php
+    if (isset($CFG->debug)) {
+        $originalconfigdebug = $CFG->debug;
+        unset($CFG->debug);
+    } else {
+        $originalconfigdebug = -1;
+    }
+
 /// If $CFG->unicodedb is not set, get it from database or calculate it because we need
 /// to know it to "set names" properly.
 /// (this is the only database interaction before "set names")
@@ -220,12 +228,13 @@ global $HTTPSPAGEREQUIRED;
         $db->LogSQL();
     }
 
-
-/// Set error reporting back to normal
-    if (!isset($CFG->debug)) { // empty() would override 0 or false from config.php
-        $CFG->debug = 5;
+/// Prevent warnings from roles when upgrading with debug on
+    if (isset($CFG->debug)) {
+        $originaldatabasedebug = $CFG->debug;
+        unset($CFG->debug);
+    } else {
+        $originaldatabasedebug = -1;
     }
-    error_reporting($CFG->debug);
 
 
 //// Defining the site
@@ -247,6 +256,20 @@ global $HTTPSPAGEREQUIRED;
     }
 
 
+/// Set error reporting back to normal
+    if ($originaldatabasedebug == -1) {
+        $CFG->debug = 5;
+    } else {
+        $CFG->debug = $originaldatabasedebug;
+    }
+    if ($originalconfigdebug !== -1) {
+        $CFG->debug = $originalconfigdebug; 
+    }
+    unset($originalconfigdebug);
+    unset($originaldatabasedebug);
+    error_reporting($CFG->debug);
+
+
 /// Set a default enrolment configuration (see bug 1598)
     if (!isset($CFG->enrol)) {
         $CFG->enrol = 'manual';