Skip to content
Browse files

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']
  • Loading branch information...
1 parent 2194bfc commit 665ffd4b4ce9a9b1a79cd9f6b87395e5ce6a491e @ayushchd committed
Showing with 18 additions and 23 deletions.
  1. +7 −0 libraries/config.default.php
  2. +0 −14 sql.php
  3. +11 −9 tbl_structure.php
View
7 libraries/config.default.php
@@ -70,6 +70,13 @@
$cfg['ServerLibraryDifference_DisableWarning'] = false;
/**
+ * Show warning about MySQL reserved words in column names
@lem9
lem9 added a note

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?

@ayushchd Owner

Okay, I'll do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ *
+ * @global boolean $cfg['ReservedWordWarning']
+ */
+$cfg['ReservedWordWarning'] = false;
@lem9
lem9 added a note

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+/**
* Show warning about incomplete translations on certain threshold.
*
* @global boolean $cfg['TranslationWarningThreshold']
View
14 sql.php
@@ -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
20 tbl_structure.php
@@ -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['ReservedWordWarning'] === true) {
+ $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);
+ }
}
}

0 comments on commit 665ffd4

Please sign in to comment.
Something went wrong with that request. Please try again.