From 3b6a994dcdf2cbcfa23caa51b3719ba924aab20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 29 Nov 2017 11:00:17 +0100 Subject: [PATCH] Move collation connection setting to user preferences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is now handled same way as other user settings. Issue #11688 Issue #13466 Signed-off-by: Michal Čihař --- import.php | 6 +- index.php | 13 +++- libraries/classes/Config.php | 76 ++----------------- libraries/classes/Config/Descriptions.php | 2 + .../Config/Forms/User/FeaturesForm.php | 1 + libraries/classes/DatabaseInterface.php | 76 +++++++++---------- libraries/classes/Header.php | 6 -- libraries/classes/Url.php | 10 --- libraries/classes/UserPreferences.php | 1 - libraries/common.inc.php | 8 +- prefs_manage.php | 5 -- test/classes/ConfigTest.php | 16 ---- test/classes/Database/SearchTest.php | 6 +- test/classes/DatabaseInterfaceTest.php | 39 ++++++++++ test/classes/Display/ResultsTest.php | 12 +-- test/classes/FooterTest.php | 9 +-- test/classes/InsertEditTest.php | 1 - test/classes/MessageTest.php | 1 - .../Plugins/Auth/AuthenticationConfigTest.php | 4 +- .../Plugins/Auth/AuthenticationCookieTest.php | 6 +- test/classes/SanitizeTest.php | 1 - test/classes/Server/PrivilegesTest.php | 7 +- test/classes/ThemeManagerTest.php | 1 - test/classes/ThemeTest.php | 2 - test/classes/UrlTest.php | 26 ++----- test/classes/UserPreferencesTest.php | 3 +- 26 files changed, 121 insertions(+), 217 deletions(-) diff --git a/import.php b/import.php index d5433df99e..dd1b929abb 100644 --- a/import.php +++ b/import.php @@ -569,10 +569,8 @@ if ($file_to_unlink != '') { // Reset charset back, if we did some changes if ($reset_charset) { - $GLOBALS['dbi']->query('SET CHARACTER SET utf8'); - $GLOBALS['dbi']->query( - 'SET SESSION collation_connection =\'' . $collation_connection . '\'' - ); + $GLOBALS['dbi']->query('SET CHARACTER SET ' . $GLOBALS['charset_connection']); + $GLOBALS['dbi']->setCollationConnection($collation_connection); } // Show correct message diff --git a/index.php b/index.php index 93a3785322..df4f420250 100644 --- a/index.php +++ b/index.php @@ -85,6 +85,17 @@ if (isset($_POST['set_theme'])) { header('Location: index.php' . Url::getCommonRaw()); exit(); } +// Change collation connection +if (isset($_POST['collation_connection'])) { + $GLOBALS['PMA_Config']->setUserValue( + null, + 'DefaultConnectionCollation', + $_POST['collation_connection'], + 'utf8mb4_unicode_ci' + ); + header('Location: index.php' . Url::getCommonRaw()); + exit(); +} // See FAQ 1.34 @@ -235,7 +246,7 @@ if ($server > 0 || count($cfg['Servers']) > 1 } } // end if echo '
  • '; - echo '
    ' , "\n" + echo ' ' , "\n" . Url::getHiddenInputs(null, null, 4, 'collation_connection') . '