diff --git a/doc/config.rst b/doc/config.rst index 9223cff823..7087ecf243 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -101,6 +101,17 @@ Basic settings You can set this parameter to ``true`` to stop this message from appearing. +.. config:option:: $cfg['ReservedWordDisableWarning'] + + :type: boolean + :default: false + + This warning is displayed on the Structure page of a table if one or more + column names match with words which are MySQL reserved. + + If you want to turn off this warning, you can set it to ``true`` and + warning will not longer be displayed + .. config:option:: $cfg['TranslationWarningThreshold'] :type: integer diff --git a/libraries/config.default.php b/libraries/config.default.php index 5d4e805b16..2d4c89baf0 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -69,6 +69,13 @@ $cfg['McryptDisableWarning'] = false; */ $cfg['ServerLibraryDifference_DisableWarning'] = false; +/** + * Disable the default warning about MySQL reserved words in column names + * + * @global boolean $cfg['ReservedWordDisableWarning'] + */ +$cfg['ReservedWordDisableWarning'] = false; + /** * Show warning about incomplete translations on certain threshold. * diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 69564bfa0e..acb0674bc0 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -333,6 +333,8 @@ $strConfigPmaNoRelation_DisableWarning_desc = __('Disable the default warning th $strConfigPmaNoRelation_DisableWarning_name = __('Missing phpMyAdmin configuration storage tables'); $strConfigServerLibraryDifference_DisableWarning_desc = __('Disable the default warning that is displayed if a difference between the MySQL library and server is detected'); $strConfigServerLibraryDifference_DisableWarning_name = __('Server/library difference warning'); +$strConfigReservedWordDisableWarning_desc = __('Disable the default warning that is displayed on the Structure page if column names in a table are reserved MySQL words'); +$strConfigReservedWordDisableWarning_name = __('MySQL reserved word warning'); $strConfigPropertiesIconic_desc = __('Use only icons, only text or both'); $strConfigPropertiesIconic_name = __('Iconic table operations'); $strConfigProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing'); diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php index 990fa2cff8..273693cb33 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -52,7 +52,8 @@ $forms['Features']['Warnings'] = array( 'ServerLibraryDifference_DisableWarning', 'PmaNoRelation_DisableWarning', 'SuhosinDisableWarning', - 'McryptDisableWarning'); + 'McryptDisableWarning', + 'ReservedWordDisableWarning'); // settings from this form are treated specially, // see prefs_forms.php and user_preferences.lib.php $forms['Features']['Developer'] = array( diff --git a/sql.php b/sql.php index c16ed09005..8e5716dc83 100644 --- a/sql.php +++ b/sql.php @@ -1213,20 +1213,6 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { echo '' . "\n"; } - - // Check column names for MySQL reserved words - $pma_table = new PMA_Table($table, $db); - $columns = $pma_table->getReservedColumnNames(); - if (! empty($columns)) { - foreach ($columns as $column) { - $msg = PMA_message::notice( - __('The column name \'%s\' is a MySQL reserved keyword.') - ); - $msg->addParam($column); - $msg->display(); - } - } - // Displays the results in a table if (empty($disp_mode)) { // see the "PMA_setDisplayMode()" function in diff --git a/tbl_structure.php b/tbl_structure.php index ffaa9dbe05..305002dea6 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -134,15 +134,17 @@ $url_params['goto'] = 'tbl_structure.php'; $url_params['back'] = 'tbl_structure.php'; // Check column names for MySQL reserved words -$pma_table = new PMA_Table($table, $db); -$columns = $pma_table->getReservedColumnNames(); -if (! empty($columns)) { - foreach ($columns as $column) { - $msg = PMA_message::notice( - __('The column name \'%s\' is a MySQL reserved keyword.') - ); - $msg->addParam($column); - $response->addHTML($msg); +if ($cfg['ReservedWordDisableWarning'] === false) { + $pma_table = new PMA_Table($table, $db); + $columns = $pma_table->getReservedColumnNames(); + if (! empty($columns)) { + foreach ($columns as $column) { + $msg = PMA_message::notice( + __('The column name \'%s\' is a MySQL reserved keyword.') + ); + $msg->addParam($column); + $response->addHTML($msg); + } } }