Skip to content

Commit

Permalink
Remove the ShowDatabasesCommand directive
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Delisle committed Nov 6, 2013
1 parent 87ffbfb commit 85ea82a
Showing 6 changed files with 7 additions and 70 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ phpMyAdmin - ChangeLog
- bug #4145 Config screen fails to validate MemoryLimit = -1 (new default)
- bug #4123 Double config including
- bug #4134 After deleting all rows on a page, it returns to a blank page
+ Dropped configuration directive: DisableIS
+ Dropped configuration directive: DisableIS, ShowDatabasesCommand

4.0.10.0 (not yet released)
- bug #4150 Clicking database name in query window opens a new tab
22 changes: 0 additions & 22 deletions doc/config.rst
Original file line number Diff line number Diff line change
@@ -1012,28 +1012,6 @@ Server connection settings

* ``xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xx[yyy-zzz]`` (partial :term:`IPv6` address range)

.. config:option:: $cfg['Servers'][$i]['ShowDatabasesCommand']
:type: string
:default: ``'SHOW DATABASES'``

On a server with a huge number of databases, the default ``SHOW DATABASES``
command used to fetch the name of available databases will probably be too
slow, so it can be replaced by faster commands. You can use ``#user#``
string will be replaced by current user.

When using ``false``, it will disable fetching databases from the server,
only databases in :config:option:`$cfg['Servers'][$i]['only_db']` will be
displayed.

Examples:

* ``'SHOW DATABASES'``
* ``"SHOW DATABASES LIKE '#user#\_%'"``
* ``'SELECT DISTINCT TABLE_SCHEMA FROM information_schema.SCHEMA_PRIVILEGES'``
* ``'SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'``
* ``false``

.. config:option:: $cfg['Servers'][$i]['SignonScript']
:type: string
22 changes: 5 additions & 17 deletions libraries/List_Database.class.php
Original file line number Diff line number Diff line change
@@ -55,12 +55,6 @@ class PMA_List_Database extends PMA_List
*/
protected $show_databases_disabled = false;

/**
* @var string command to retrieve databases from server
* @access protected
*/
protected $command = null;

/**
* Constructor
*
@@ -103,24 +97,18 @@ protected function checkHideDatabase()
* @param string $like_db_name usually a db_name containing wildcards
*
* @return array
* @todo we could also search mysql tables if all fail?
*/
protected function retrieve($like_db_name = null)
{
if ($this->show_databases_disabled) {
return array();
}

$command = "SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`"
. " WHERE TRUE";

if (null !== $like_db_name) {
$command = "SHOW DATABASES LIKE '" . $like_db_name . "'";
} elseif (null === $this->command) {
$command = str_replace(
'#user#', $GLOBALS['cfg']['Server']['user'],
$GLOBALS['cfg']['Server']['ShowDatabasesCommand']
);
$this->command = $command;
} else {
$command = $this->command;
$command .= " AND `SCHEMA_NAME` LIKE '" . $like_db_name . "'";
}

$database_list = $GLOBALS['dbi']->fetchResult(
@@ -130,7 +118,7 @@ protected function retrieve($like_db_name = null)

if ($GLOBALS['errno'] !== 0) {
// failed to get database list, try the control user
// (hopefully there is one and he has SHOW DATABASES right)
// (hopefully there is one and he has the necessary rights)
$this->db_link = $this->db_link_control;
$database_list = $GLOBALS['dbi']->fetchResult(
$command, null, null, $this->db_link
26 changes: 0 additions & 26 deletions libraries/config.default.php
Original file line number Diff line number Diff line change
@@ -513,32 +513,6 @@
*/
$cfg['Servers'][$i]['AllowDeny']['rules'] = array();

/**
* SQL command to fetch available databases
*
* by default most user will be fine with SHOW DATABASES,
* for servers with a huge amount of databases it is possible to
* define a command which executes faster but with less information
*
* especially when accessing database servers from ISPs changing this command
* can result in a great speed improvement
*
* false will disable fetching databases from the server, only databases in
* $cfg['Servers'][$i]['only_db'] will be displayed
*
* #user# will be replaced by current user
*
* examples:
* 'SHOW DATABASES'
* "SHOW DATABASES LIKE '#user#\_%'"
* 'SELECT DISTINCT TABLE_SCHEMA FROM information_schema.SCHEMA_PRIVILEGES'
* 'SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'
* false
*
* @global array $cfg['Servers'][$i]['ShowDatabasesCommand']
*/
$cfg['Servers'][$i]['ShowDatabasesCommand'] = 'SHOW DATABASES';

/**
* Whether the tracking mechanism creates
* versions for tables and views automatically.
2 changes: 0 additions & 2 deletions libraries/config/messages.inc.php
Original file line number Diff line number Diff line change
@@ -422,8 +422,6 @@
$strConfigServers_recent_name = __('Recently used table');
$strConfigServers_relation_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation]relation-links[/a] support, suggested: [kbd]pma__relation[/kbd]');
$strConfigServers_relation_name = __('Relation table');
$strConfigServers_ShowDatabasesCommand_desc = __('SQL command to fetch available databases');
$strConfigServers_ShowDatabasesCommand_name = __('SHOW DATABASES command');
$strConfigServers_SignonSession_desc = __('See [a@http://wiki.phpmyadmin.net/pma/auth_types#signon]authentication types[/a] for an example');
$strConfigServers_SignonSession_name = __('Signon session name');
$strConfigServers_SignonURL_name = __('Signon URL');
3 changes: 1 addition & 2 deletions libraries/config/setup.forms.php
Original file line number Diff line number Diff line change
@@ -58,8 +58,7 @@
'AllowRoot',
'AllowNoPassword',
'AllowDeny/order',
'AllowDeny/rules',
'ShowDatabasesCommand')));
'AllowDeny/rules')));
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',

0 comments on commit 85ea82a

Please sign in to comment.