Permalink
Browse files

Moving set_dbfamily() from dmllib.php to setuplib.php as it's

needed in early stages and we don't want the installer to
depend of dmllib.
  • Loading branch information...
stronk7
stronk7 committed Jan 13, 2007
1 parent 3488d0e commit 1d5c40048a7a74c82c658e938f36ad482999ecd1
Showing with 44 additions and 45 deletions.
  1. +0 −1 install.php
  2. +0 −44 lib/dmllib.php
  3. +44 −0 lib/setuplib.php
View
@@ -125,7 +125,6 @@
require_once('./lib/setuplib.php');
require_once('./lib/moodlelib.php');
require_once('./lib/weblib.php');
-require_once('./lib/dmllib.php');
require_once('./lib/deprecatedlib.php');
require_once('./lib/adodb/adodb.inc.php');
require_once('./lib/environmentlib.php');
View
@@ -1821,50 +1821,6 @@ function configure_dbconnection() {
set_dbfamily();
}
-/**
- * This internal function sets and returns the proper value for $CFG->dbfamily based on $CFG->dbtype
- * It's called by configure_dbconnection() and at install time. Shouldn't be used
- * in other places. Code should rely on dbfamily to perform conditional execution
- * instead of using dbtype directly. This allows quicker adoption of different
- * drivers going against the same DB backend.
- *
- * This function must contain the init code needed for each dbtype supported.
- *
- * return string dbfamily value (mysql, postgres, oracle, mssql)
- */
-function set_dbfamily() {
-
- global $CFG, $INSTALL;
-
- // 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';
- break;
- case 'postgres7':
- $CFG->dbfamily='postgres';
- break;
- case 'mssql':
- case 'mssql_n':
- case 'odbc_mssql':
- $CFG->dbfamily='mssql';
- break;
- case 'oci8po':
- $CFG->dbfamily='oracle';
- break;
- }
-
- return $CFG->dbfamily;
-}
-
/**
* This function will handle all the records before being inserted/updated to DB for Oracle
* installations. This is because the "special feature" of Oracle where the empty string is
View
@@ -202,6 +202,50 @@ function setup_is_unicodedb() {
return $unicodedb;
}
+/**
+ * This internal function sets and returns the proper value for $CFG->dbfamily based on $CFG->dbtype
+ * It's called by configure_dbconnection() and at install time. Shouldn't be used
+ * in other places. Code should rely on dbfamily to perform conditional execution
+ * instead of using dbtype directly. This allows quicker adoption of different
+ * drivers going against the same DB backend.
+ *
+ * This function must contain the init code needed for each dbtype supported.
+ *
+ * return string dbfamily value (mysql, postgres, oracle, mssql)
+ */
+function set_dbfamily() {
+
+ global $CFG, $INSTALL;
+
+ // 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';
+ break;
+ case 'postgres7':
+ $CFG->dbfamily='postgres';
+ break;
+ case 'mssql':
+ case 'mssql_n':
+ case 'odbc_mssql':
+ $CFG->dbfamily='mssql';
+ break;
+ case 'oci8po':
+ $CFG->dbfamily='oracle';
+ break;
+ }
+
+ return $CFG->dbfamily;
+}
+
function init_memcached() {
global $CFG, $MCACHE;

0 comments on commit 1d5c400

Please sign in to comment.