]> git.mjollnir.org Git - moodle.git/commitdiff
Now set_dbfamily() will work properly when invoked from install.
authorstronk7 <stronk7>
Fri, 12 Jan 2007 23:52:23 +0000 (23:52 +0000)
committerstronk7 <stronk7>
Fri, 12 Jan 2007 23:52:23 +0000 (23:52 +0000)
lib/dmllib.php

index d3f73483cef7b88657aaf6e476b49d2e84b0b9cf..fb8bf2e64c3aae8e95943920f993172ceb735e74 100644 (file)
@@ -1832,9 +1832,17 @@ function configure_dbconnection() {
  */
 function set_dbfamily() {
 
-    global $CFG;
+    global $CFG, $INSTALL;
 
-    switch ($CFG->dbtype) {
+    // 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 ($dbtype) {
         case 'mysql':
         case 'mysqli':
             $CFG->dbfamily='mysql';