From 3bf78afeca5c4965aa1fef66f2bdf34409e2a2da Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Thu, 12 Jan 2017 22:06:25 -0500 Subject: [PATCH 1/3] Only convert table name to lower-case when installation forces it Issue #12861 A `lower_case_table_names` setting of `2` does not mean that the table needs to be forced to lower-case This preserves case unless the `lower_case_table_names` setting is `1`, implying that lower-case should be forced Signed-off-by: Mike Lewis --- libraries/Table.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Table.php b/libraries/Table.php index c4fca789a8..7e5792e246 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -1350,7 +1350,7 @@ class Table ); } ); - if ($lowerCaseTableNames) { + if ($lowerCaseTableNames === '1') { $new_name = strtolower($new_name); } From 89357ee0f16b9be36d80d7e5d3d8727923ba2ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 18 Jan 2017 09:58:29 +0100 Subject: [PATCH 2/3] Share code for getting lower_case_table_names value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #12861 Signed-off-by: Michal Čihař --- libraries/Table.php | 10 +--------- libraries/operations.lib.php | 5 +---- test/classes/TableTest.php | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/libraries/Table.php b/libraries/Table.php index 7e5792e246..5aae6a7043 100644 --- a/libraries/Table.php +++ b/libraries/Table.php @@ -1342,15 +1342,7 @@ class Table */ function rename($new_name, $new_db = null) { - $lowerCaseTableNames = Util::cacheGet( - 'lower_case_table_names', - function () { - return $GLOBALS['dbi']->fetchValue( - "SELECT @@lower_case_table_names" - ); - } - ); - if ($lowerCaseTableNames === '1') { + if ($GLOBALS['dbi']->getLowerCaseNames() === '1') { $new_name = strtolower($new_name); } diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index 358bd8a2b5..89d6103881 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -353,10 +353,7 @@ function PMA_runProcedureAndFunctionDefinitions($db) function PMA_createDbBeforeCopy() { // lower_case_table_names=1 `DB` becomes `db` - $lowerCaseTableNames = $GLOBALS['dbi']->fetchValue( - 'SELECT @@lower_case_table_names' - ); - if ($lowerCaseTableNames === '1') { + if ($GLOBALS['dbi']->getLowerCaseNames() === '1') { $_REQUEST['newname'] = mb_strtolower( $_REQUEST['newname'] ); diff --git a/test/classes/TableTest.php b/test/classes/TableTest.php index 760cdefe02..97ed81d4fa 100644 --- a/test/classes/TableTest.php +++ b/test/classes/TableTest.php @@ -751,7 +751,6 @@ class TableTest extends PMATestCase { $table = 'PMA_BookMark'; $db = 'PMA'; - Util::cacheSet('lower_case_table_names', false); $table = new Table($table, $db); From f1aefb1fa550cebe8f231c4a847c7d4b391524b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 18 Jan 2017 09:59:12 +0100 Subject: [PATCH 3/3] Changelog entry for #12861 and #12891 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 0208f46c72..df7f4a3952 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ phpMyAdmin - ChangeLog - issue #12868 Fix check for user groups freatures being enabled - issue #12831 Fix table formatting on Insert tab, which mostly affected row highlighting - issue #12495 Reintroduced phpinfo page with limited capabilities +- issue #12861 Fix renaming tables with lower_case_table_names=2 4.6.5.2 (2016-12-05) - issue #12765 Fixed SQL export with newlines