Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Reserved words issue #216

Merged
merged 2 commits into from about 1 year ago

2 participants

Ayush Chaudhary Marc Delisle
Ayush Chaudhary

The configuration is now set to display the warning by default. Config has been documented in config.rst and config can also be changed from the Features settings under the 'Warnings' tab

Ayush Chaudhary Reserved word warning config
This commit removes reserved word warning from the Browse pages and the
warning on structure page can be switched on/off using the config
variable $cfg['ReservedWordWarning']
665ffd4
Marc Delisle

It's not an easy choice to pick up a default value but I think the community would be best served by setting this to true.

Marc Delisle

When adding a new directive, you should document it. This is done in doc/config.rst and I suggest adding a short paragraph in the Generic settings section.

It would be interesting also to offer the user a chance to change the directive, via the user prefs module (the "More settings" link on home page). Can you take care of these two issues?

Okay, I'll do that.

Ayush Chaudhary Added ability to disable MySQL reserved word warning
Disable MySQL reserved word warning $cfg['ReservedWordDisableWarning'],
documentation and ability to change from prefs pane
27967e7
Marc Delisle
Owner
lem9 commented March 21, 2013

Good job!

Marc Delisle lem9 merged commit b48affc into from March 21, 2013
Marc Delisle lem9 closed this March 21, 2013
Ayush Chaudhary

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Mar 10, 2013
Ayush Chaudhary Reserved word warning config
This commit removes reserved word warning from the Browse pages and the
warning on structure page can be switched on/off using the config
variable $cfg['ReservedWordWarning']
665ffd4
Mar 21, 2013
Ayush Chaudhary Added ability to disable MySQL reserved word warning
Disable MySQL reserved word warning $cfg['ReservedWordDisableWarning'],
documentation and ability to change from prefs pane
27967e7
This page is out of date. Refresh to see the latest.
11  doc/config.rst
Source Rendered
@@ -101,6 +101,17 @@ Basic settings
101 101
     
102 102
     You can set this parameter to ``true`` to stop this message from appearing.
103 103
 
  104
+.. config:option:: $cfg['ReservedWordDisableWarning']
  105
+
  106
+    :type: boolean
  107
+    :default: false
  108
+
  109
+    This warning is displayed on the Structure page of a table if one or more
  110
+    column names match with words which are MySQL reserved.
  111
+
  112
+    If you want to turn off this warning, you can set it to ``true`` and 
  113
+    warning will not longer be displayed 
  114
+
104 115
 .. config:option:: $cfg['TranslationWarningThreshold']
105 116
 
106 117
     :type: integer
7  libraries/config.default.php
@@ -70,6 +70,13 @@
70 70
 $cfg['ServerLibraryDifference_DisableWarning'] = false;
71 71
 
72 72
 /**
  73
+ * Disable the default warning about MySQL reserved words in column names
  74
+ *
  75
+ * @global boolean $cfg['ReservedWordDisableWarning']
  76
+ */
  77
+$cfg['ReservedWordDisableWarning'] = false;
  78
+
  79
+/**
73 80
  * Show warning about incomplete translations on certain threshold.
74 81
  *
75 82
  * @global boolean $cfg['TranslationWarningThreshold']
2  libraries/config/messages.inc.php
@@ -333,6 +333,8 @@
333 333
 $strConfigPmaNoRelation_DisableWarning_name = __('Missing phpMyAdmin configuration storage tables');
334 334
 $strConfigServerLibraryDifference_DisableWarning_desc = __('Disable the default warning that is displayed if a difference between the MySQL library and server is detected');
335 335
 $strConfigServerLibraryDifference_DisableWarning_name = __('Server/library difference warning');
  336
+$strConfigReservedWordDisableWarning_desc = __('Disable the default warning that is displayed on the Structure page if column names in a table are reserved MySQL words');
  337
+$strConfigReservedWordDisableWarning_name = __('MySQL reserved word warning');
336 338
 $strConfigPropertiesIconic_desc = __('Use only icons, only text or both');
337 339
 $strConfigPropertiesIconic_name = __('Iconic table operations');
338 340
 $strConfigProtectBinary_desc = __('Disallow BLOB and BINARY columns from editing');
3  libraries/config/user_preferences.forms.php
@@ -52,7 +52,8 @@
52 52
     'ServerLibraryDifference_DisableWarning',
53 53
     'PmaNoRelation_DisableWarning',
54 54
     'SuhosinDisableWarning',
55  
-    'McryptDisableWarning');
  55
+    'McryptDisableWarning',
  56
+    'ReservedWordDisableWarning');
56 57
 // settings from this form are treated specially,
57 58
 // see prefs_forms.php and user_preferences.lib.php
58 59
 $forms['Features']['Developer'] = array(
14  sql.php
@@ -1203,20 +1203,6 @@
1203 1203
         echo '</fieldset>' . "\n";
1204 1204
     }
1205 1205
 
1206  
-    
1207  
-    // Check column names for MySQL reserved words
1208  
-    $pma_table = new PMA_Table($table, $db);
1209  
-    $columns = $pma_table->getReservedColumnNames();
1210  
-    if (! empty($columns)) {
1211  
-        foreach ($columns as $column) {
1212  
-            $msg = PMA_message::notice(
1213  
-                __('The column name \'%s\' is a MySQL reserved keyword.')
1214  
-            );
1215  
-            $msg->addParam($column);
1216  
-            $msg->display();
1217  
-        }
1218  
-    }
1219  
-    
1220 1206
     // Displays the results in a table
1221 1207
     if (empty($disp_mode)) {
1222 1208
         // see the "PMA_setDisplayMode()" function in
20  tbl_structure.php
@@ -134,15 +134,17 @@
134 134
 $url_params['back'] = 'tbl_structure.php';
135 135
 
136 136
 // Check column names for MySQL reserved words
137  
-$pma_table = new PMA_Table($table, $db);
138  
-$columns = $pma_table->getReservedColumnNames();
139  
-if (! empty($columns)) {
140  
-    foreach ($columns as $column) {
141  
-        $msg = PMA_message::notice(
142  
-            __('The column name \'%s\' is a MySQL reserved keyword.')
143  
-        );
144  
-        $msg->addParam($column);
145  
-        $response->addHTML($msg);
  137
+if ($cfg['ReservedWordDisableWarning'] === false) {
  138
+    $pma_table = new PMA_Table($table, $db);
  139
+    $columns = $pma_table->getReservedColumnNames();
  140
+    if (! empty($columns)) {
  141
+        foreach ($columns as $column) {
  142
+            $msg = PMA_message::notice(
  143
+                __('The column name \'%s\' is a MySQL reserved keyword.')
  144
+            );
  145
+            $msg->addParam($column);
  146
+            $response->addHTML($msg);
  147
+        }
146 148
     }
147 149
 }
148 150
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.