Adding some $CFG->dbfamily-s here and there. MDL-7061

This commit is contained in:
stronk7 2007-01-12 00:06:08 +00:00
parent 93901eb42f
commit 60b562c49e
7 changed files with 10 additions and 14 deletions

View File

@ -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.');
}

View File

@ -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');
}

View File

@ -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

View File

@ -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.',

View File

@ -126,7 +126,7 @@ class edit_xml_file extends XMLDBAction {
/// The new table button
$b .= '&nbsp;<a href="index.php?action=new_table&amp;postaction=edit_table&amp;table=changeme&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtable'] . ']</a>';
/// The new from MySQL button
if ($CFG->dbtype == 'mysql') {
if ($CFG->dbfamily == 'mysql') {
$b .= '&nbsp;<a href="index.php?action=new_table_from_mysql&amp;dir=' . urlencode(str_replace($CFG->dirroot, '', $dirpath)) . '">[' . $this->str['newtablefrommysql'] . ']</a>';
} else {
$b .= '&nbsp;[' . $this->str['newtablefrommysql'] . ']';

View File

@ -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);
}

View File

@ -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;
}
?>
?>