From: stronk7 Date: Fri, 12 Jan 2007 00:06:08 +0000 (+0000) Subject: Adding some $CFG->dbfamily-s here and there. MDL-7061 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=60b562c49e039b16032be361f6050c525b130203;p=moodle.git Adding some $CFG->dbfamily-s here and there. MDL-7061 --- diff --git a/admin/index.php b/admin/index.php index 050be7bb69..52a8953dde 100644 --- a/admin/index.php +++ b/admin/index.php @@ -52,11 +52,11 @@ error("The PHP server variable 'file_uploads' is not turned On - $documentationlink"); } - if (empty($CFG->prefix) && $CFG->dbtype != 'mysql') { //Enforce prefixes for everybody but mysql + if (empty($CFG->prefix) && $CFG->family != 'mysql') { //Enforce prefixes for everybody but mysql error('$CFG->prefix can\'t be empty for your target DB (' . $CFG->dbtype . ')'); } - if ($CFG->dbtype == 'oci8po' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc + if ($CFG->dbfamily == 'oracle' && strlen($CFG->prefix) > 2) { //Max prefix length for Oracle is 2cc error('$CFG->prefix maximum allowed length for Oracle DBs is 2cc.'); } diff --git a/admin/innodb.php b/admin/innodb.php index 6d73b5b49d..194917536a 100644 --- a/admin/innodb.php +++ b/admin/innodb.php @@ -14,7 +14,7 @@ admin_externalpage_print_header($adminroot); print_heading('Convert all MySQL tables from MYISAM to InnoDB'); - if ($CFG->dbtype != 'mysql') { + if ($CFG->dbfamily != 'mysql') { notice('This function is for MySQL databases only!', 'index.php'); } diff --git a/admin/settings/top.php b/admin/settings/top.php index 58fb07b826..e638989bf4 100644 --- a/admin/settings/top.php +++ b/admin/settings/top.php @@ -31,7 +31,7 @@ $ADMIN->add('root', new admin_category('mnet', get_string('net','mnet'))); $ADMIN->add('root', new admin_category('reports', get_string('reports'))); foreach (get_list_of_plugins('admin/report') as $plugin) { /// This snippet is temporary until simpletest can be fixed to use xmldb. See MDL-7377 XXX TODO - if ($plugin == 'simpletest' && $CFG->dbtype != 'mysql' && $CFG->dbtype != 'postgres7') { + if ($plugin == 'simpletest' && $CFG->dbfamily != 'mysql' && $CFG->dbfamily != 'postgres') { continue; } /// End of removable snippet diff --git a/admin/upgradelogs.php b/admin/upgradelogs.php index abe4fae9bb..a70327a964 100644 --- a/admin/upgradelogs.php +++ b/admin/upgradelogs.php @@ -52,11 +52,7 @@ $starttime = time(); $sleeptime = 0; - if ($CFG->dbtype == "mysql") { - $LIKE = "LIKE"; - } else { - $LIKE = "ILIKE"; - } + $LIKE = sql_ilike(); if ($cmcount > 10) { print_simple_box('This process may take a very long time ... please be patient and let it finish.', diff --git a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php index 48f2976ec6..1dfba4904f 100644 --- a/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php +++ b/admin/xmldb/actions/edit_xml_file/edit_xml_file.class.php @@ -126,7 +126,7 @@ class edit_xml_file extends XMLDBAction { /// The new table button $b .= ' [' . $this->str['newtable'] . ']'; /// The new from MySQL button - if ($CFG->dbtype == 'mysql') { + if ($CFG->dbfamily == 'mysql') { $b .= ' [' . $this->str['newtablefrommysql'] . ']'; } else { $b .= ' [' . $this->str['newtablefrommysql'] . ']'; diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 301a580039..f2f7e9c791 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -413,12 +413,12 @@ class auth_plugin_ldap { // configure a temp table print "Configuring temp table\n"; - if (strtolower($CFG->dbtype) === 'mysql') { + if (strtolower($CFG->dbfamily) === 'mysql') { // help old mysql versions cope with large temp tables execute_sql('SET SQL_BIG_TABLES=1', false); execute_sql('CREATE TEMPORARY TABLE ' . $CFG->prefix .'extuser (idnumber VARCHAR(64), PRIMARY KEY (idnumber)) TYPE=MyISAM',false); } - elseif (strtolower($CFG->dbtype) === 'postgres7') { + elseif (strtolower($CFG->dbfamily) === 'postgres') { $bulk_insert_records = 1; // no support for multiple sets of values execute_sql('CREATE TEMPORARY TABLE '.$CFG->prefix.'extuser (idnumber VARCHAR(64), PRIMARY KEY (idnumber))',false); } diff --git a/group/db/dbsetup.php b/group/db/dbsetup.php index cab2cdca3d..973f799b8e 100644 --- a/group/db/dbsetup.php +++ b/group/db/dbsetup.php @@ -48,7 +48,7 @@ require_once($CFG->libdir.'/datalib.php'); function groups_create_database_tables() { global $CFG; - if ('mysql' == $CFG->dbtype) { + if ('mysql' == $CFG->dbfamily) { $createcoursegrouptablesql = "CREATE TABLE IF NOT EXISTS `{$CFG->prefix}groups_courses_groups` ( `id` int(10) unsigned NOT NULL auto_increment, @@ -257,4 +257,4 @@ function groups_db_copy_moodle_group_to_imsgroup($groupid, $courseid) { return $success; } -?> \ No newline at end of file +?>