]> git.mjollnir.org Git - moodle.git/commitdiff
merged, adding addtional check to change_db_encoding to make sure db not already...
authortoyomoyo <toyomoyo>
Thu, 19 Oct 2006 02:14:43 +0000 (02:14 +0000)
committertoyomoyo <toyomoyo>
Thu, 19 Oct 2006 02:14:43 +0000 (02:14 +0000)
lib/ddllib.php

index 2eefddabc30f812e92bcd2cef7549ea864e1ecc7..70f4e097b73d4f56acce61b5a38b08c1f1345cd2 100644 (file)
@@ -1145,9 +1145,13 @@ function rename_index($table, $index, $newname, $continue=true, $feedback=true)
 function change_db_encoding() {
     global $CFG, $db;  
     // try forcing utf8 collation, if mysql db and no tables present
-    if (!$db->Metatables() && ($CFG->dbtype=='mysql')) {
+    if (!$db->Metatables() && ($CFG->dbtype=='mysql') && empty($CFG->unicodedb)) {
         $SQL = 'ALTER DATABASE '.$CFG->dbname.' CHARACTER SET utf8';
         execute_sql($SQL, false); // silent, if it fails it fails
+        if (setup_is_unicodedb()) {
+            // set_config('unicodedb','true'); // can not set config because there is no config table yet =(
+            configure_dbconnection();   
+        } 
     }
 }