From: stronk7 Date: Fri, 12 Jan 2007 23:52:23 +0000 (+0000) Subject: Now set_dbfamily() will work properly when invoked from install. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d847d4027bf4fb1ac04a06d14f94781fb3633129;p=moodle.git Now set_dbfamily() will work properly when invoked from install. --- diff --git a/lib/dmllib.php b/lib/dmllib.php index d3f73483ce..fb8bf2e64c 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -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';