Merge pull request #207 from lem9/bug_3820_only_db

Bug 3820 only db
This commit is contained in:
Marc Delisle 2013-03-12 09:41:57 -07:00
commit a3d62074c8
6 changed files with 21 additions and 24 deletions

View File

@ -96,6 +96,7 @@ underscore
- bug #3830 Can't export custom query because it lowercases table names
- bug #3829 Enabling query profiling crashes javascript based navigation
+ rfe #879 Reserved word warning
+ Remove the database ordering sub-feature of the only_db directive
3.5.8.0 (not yet released)
- bug #3828 MariaDB reported as MySQL

View File

@ -364,20 +364,9 @@ Server connection settings
$cfg['Servers'][$i]['only_db'] = array('db1', 'db2');
.. versionchanged:: 2.5.5
The order inside the array is used for sorting the
databases in the navigation panel, so that you can individually
arrange your databases.
If you want to have certain databases at the top, but don't care about the
others, you do not need to specify all other databases. Use following code
instead to tell phpMyAdmin that it should display db3 and db4 on top, and
the rest in alphabetic order:
.. code-block:: php
$cfg['Servers'][$i]['only_db'] = array('db3', 'db4', '\*');
.. versionchanged:: 4.0.0
Previous versions permitted to specify the display order of
the database names via this directive.
.. config:option:: $cfg['Servers'][$i]['hide_db']

View File

@ -192,14 +192,6 @@ class PMA_List_Database extends PMA_List
$items = array();
foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
if ($each_only_db === '*' && ! $this->show_databases_disabled) {
// append all not already listed dbs to the list
$items = array_merge(
$items, array_diff($this->retrieve(), $items)
);
// there can only be one '*', and this can only be last
break;
}
// check if the db name contains wildcard,
// thus containing not escaped _ or %

View File

@ -251,7 +251,7 @@ $cfg['Servers'][$i]['nopassword'] = false;
/**
* If set to a db-name, only this db is displayed in navigation panel
* It may also be an array of db-names, where sorting order is relevant.
* It may also be an array of db-names
*
* @global string $cfg['Servers'][$i]['only_db']
*/

View File

@ -403,7 +403,7 @@ $strConfigServers_MaxTableUiprefs_desc = __('Limits number of table preferences
$strConfigServers_MaxTableUiprefs_name = __('Maximal number of table preferences to store');
$strConfigServers_nopassword_desc = __('Try to connect without password');
$strConfigServers_nopassword_name = __('Connect without password');
$strConfigServers_only_db_desc = __('You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use [kbd]\'my\_db\'[/kbd] and not [kbd]\'my_db\'[/kbd]. Using this option you can sort database list, just enter their names in order and use [kbd]*[/kbd] at the end to show the rest in alphabetical order.');
$strConfigServers_only_db_desc = __('You can use MySQL wildcard characters (% and _), escape them if you want to use their literal instances, i.e. use [kbd]\'my\_db\'[/kbd] and not [kbd]\'my_db\'[/kbd].');
$strConfigServers_only_db_name = __('Show only listed databases');
$strConfigServers_password_desc = __('Leave empty if not using config auth');
$strConfigServers_password_name = __('Password for config auth');

View File

@ -433,6 +433,21 @@ class Node
$whereClause .= "AND `SCHEMA_NAME` NOT REGEXP '"
. $GLOBALS['cfg']['Server']['hide_db'] . "' ";
}
if (! empty($GLOBALS['cfg']['Server']['only_db'])) {
if (is_string($GLOBALS['cfg']['Server']['only_db'])) {
$GLOBALS['cfg']['Server']['only_db'] = array(
$GLOBALS['cfg']['Server']['only_db']
);
}
$whereClause .= "AND (";
$subClauses = array();
foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
$subClauses[] = " `SCHEMA_NAME` LIKE '"
. $each_only_db . "' ";
}
$whereClause .= implode("OR", $subClauses) . ")";
}
return $whereClause;
}