diff --git a/libraries/mysql_charsets.lib.php b/libraries/mysql_charsets.lib.php index 4abeb5dafe75..31376c7648b5 100644 --- a/libraries/mysql_charsets.lib.php +++ b/libraries/mysql_charsets.lib.php @@ -95,26 +95,14 @@ function PMA_getDbCollation($db) return 'utf8_general_ci'; } - if (! $GLOBALS['cfg']['Server']['DisableIS']) { - // this is slow with thousands of databases - $sql = PMA_DRIZZLE - ? 'SELECT DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS' - . ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db) - . '\' LIMIT 1' - : 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA' - . ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db) - . '\' LIMIT 1'; - return $GLOBALS['dbi']->fetchValue($sql); - } else { - $GLOBALS['dbi']->selectDb($db); - $return = $GLOBALS['dbi']->fetchValue( - 'SHOW VARIABLES LIKE \'collation_database\'', 0, 1 - ); - if ($db !== $GLOBALS['db']) { - $GLOBALS['dbi']->selectDb($GLOBALS['db']); - } - return $return; - } + $sql = PMA_DRIZZLE + ? 'SELECT DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS' + . ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db) + . '\' LIMIT 1' + : 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA' + . ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db) + . '\' LIMIT 1'; + return $GLOBALS['dbi']->fetchValue($sql); } /** diff --git a/test/classes/plugin/export/PMA_ExportSql_test.php b/test/classes/plugin/export/PMA_ExportSql_test.php index 07fc75f47f13..941cbd1abf33 100644 --- a/test/classes/plugin/export/PMA_ExportSql_test.php +++ b/test/classes/plugin/export/PMA_ExportSql_test.php @@ -778,18 +778,12 @@ public function testExportDBCreate() // case2: no backquotes unset($GLOBALS['sql_compatibility']); - $GLOBALS['cfg']['Server']['DisableIS'] = true; unset($GLOBALS['sql_backquotes']); $dbi = $this->getMockBuilder('PMA_DatabaseInterface') ->disableOriginalConstructor() ->getMock(); - $dbi->expects($this->once()) - ->method('fetchValue') - ->with('SHOW VARIABLES LIKE \'collation_database\'', 0, 1) - ->will($this->returnValue('testcollation')); - $GLOBALS['dbi'] = $dbi; ob_start(); @@ -804,7 +798,7 @@ public function testExportDBCreate() ); $this->assertContains( - 'CREATE DATABASE IF NOT EXISTS db DEFAULT CHARACTER SET testcollation;', + 'CREATE DATABASE IF NOT EXISTS db', $result ); @@ -1196,7 +1190,6 @@ public function testGetTableDefWithoutDrizzle() ->will($this->returnValue($row)); $GLOBALS['dbi'] = $dbi; - $GLOBALS['cfg']['Server']['DisableIS'] = false; $result = $this->object->getTableDef( 'db', 'table', "\n", "example.com/err", true, true, true @@ -1373,7 +1366,6 @@ public function testGetTableDefWithDrizzle() ->will($this->returnValue($row)); $GLOBALS['dbi'] = $dbi; - $GLOBALS['cfg']['Server']['DisableIS'] = false; $result = $this->object->getTableDef( 'db', 'table', "\n", "example.com/err", true, true, true @@ -1496,7 +1488,6 @@ public function testGetTableDefWithError() ->will($this->returnValue('error occurred')); $GLOBALS['dbi'] = $dbi; - $GLOBALS['cfg']['Server']['DisableIS'] = false; $result = $this->object->getTableDef( 'db', 'table', "\n", "example.com/err", true, true, true @@ -1839,7 +1830,6 @@ public function testExportData() $GLOBALS['sql_truncate'] = true; $GLOBALS['sql_insert_syntax'] = 'both'; $GLOBALS['sql_hex_for_blob'] = true; - $GLOBALS['cfg']['Server']['DisableIS'] = false; ob_start(); $this->object->exportData( @@ -1954,7 +1944,6 @@ public function testExportDataWithUpdate() $GLOBALS['sql_truncate'] = true; $GLOBALS['sql_insert_syntax'] = 'both'; $GLOBALS['sql_hex_for_blob'] = true; - $GLOBALS['cfg']['Server']['DisableIS'] = false; ob_start(); $this->object->exportData( @@ -1987,7 +1976,6 @@ public function testExportDataWithIsView() ->will($this->returnValue(true)); $GLOBALS['dbi'] = $dbi; - $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['sql_views_as_tables'] = false; $GLOBALS['sql_include_comments'] = true; $GLOBALS['crlf'] = "\n"; @@ -2025,7 +2013,6 @@ public function testExportDataWithError() ->will($this->returnValue('err')); $GLOBALS['dbi'] = $dbi; - $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['sql_views_as_tables'] = true; $GLOBALS['sql_include_comments'] = true; $GLOBALS['crlf'] = "\n"; diff --git a/test/libraries/PMA_mysql_charsets_test.php b/test/libraries/PMA_mysql_charsets_test.php index a1f26423740b..1d3f6cd4ef77 100644 --- a/test/libraries/PMA_mysql_charsets_test.php +++ b/test/libraries/PMA_mysql_charsets_test.php @@ -108,7 +108,6 @@ public function testGetDbCollation() define('PMA_DRIZZLE', false); } - $GLOBALS['cfg']['Server']['DisableIS'] = false; $GLOBALS['cfg']['DBG']['sql'] = false; $this->assertEquals( @@ -123,12 +122,6 @@ public function testGetDbCollation() PMA_getDbCollation('pma_test') ); - $GLOBALS['cfg']['Server']['DisableIS'] = true; - $GLOBALS['db'] = 'pma_test2'; - $this->assertEquals( - 'bar', - PMA_getDbCollation('pma_test') - ); $this->assertNotEquals( 'pma_test', $GLOBALS['dummy_db']