]> git.mjollnir.org Git - moodle.git/commitdiff
adding more checks to make sure 1.8 is unicode only MDL-6332
authortoyomoyo <toyomoyo>
Thu, 9 Nov 2006 04:27:44 +0000 (04:27 +0000)
committertoyomoyo <toyomoyo>
Thu, 9 Nov 2006 04:27:44 +0000 (04:27 +0000)
lib/setup.php
lib/setuplib.php

index 4ae544fba491b284873d4ffd978f2c9cadeeb448..d30a2584ddfa2d9373bdbd3086e4b8e86cbad845 100644 (file)
@@ -213,6 +213,7 @@ global $HTTPSPAGEREQUIRED;
             set_config('unicodedb', $CFG->unicodedb);
         }
     }
+    
 /// Set the client/server and connection to utf8 if necessary
 /// and configure some other specific variables for each db
     configure_dbconnection();
@@ -637,4 +638,9 @@ $CFG->os = PHP_OS;
         }
     }
 
+/// Moodle 1.8 needs to be run on unicode, kill if not unicodedb
+    if (!$CFG->unicodedb) {
+        print_error('unicoderequired', 'admin');
+    }
+    
 ?>
index a92fe4ff9e65d7a07a603ec28f878ff2e3beb7ea..13cd7f50789485aa4ab9f8b5468564acc4fbe94e 100644 (file)
@@ -91,13 +91,20 @@ function make_upload_directory($directory, $shownotices=true) {
  */
 function setup_is_unicodedb() {
 
-    global $CFG, $db;
+    global $CFG, $db, $INSTALL;
 
     $unicodedb = false;
+    
+    // Since this function is also used during installation process, i.e. during install.php before $CFG->dbtype is set.
+    // we need to get dbtype from the right variable 
+    if (!empty($INSTALL['dbtype'])) {
+        $dbtype = $INSTALL['dbtype'];
+    } else {
+        $dbtype = $CFG->dbtype;
+    }
 
-    switch ($CFG->dbtype) {
+    switch ($dbtype) {
         case 'mysql':
-        /// Get MySQL character_set_database value
             $rs = $db->Execute("SHOW VARIABLES LIKE 'character_set_database'");
             if ($rs && $rs->RecordCount() > 0) {
                 $records = $rs->GetAssoc(true);