Reserved words issue #216

Merged
merged 2 commits into from Mar 21, 2013
View
@@ -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
@@ -70,6 +70,13 @@
$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.
*
* @global boolean $cfg['TranslationWarningThreshold']
@@ -333,6 +333,8 @@
$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');
@@ -52,7 +52,8 @@
'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(
View
@@ -1203,20 +1203,6 @@
echo '</fieldset>' . "\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
View
@@ -134,15 +134,17 @@
$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);
+ }
}
}