[config] new parameter $cfg['Servers'][$i]['ShowDatabasesCommand']

This commit is contained in:
Sebastian Mendel
2008-01-29 13:17:07 +00:00
parent 43b2a67a36
commit d80d5ee2f3
3 changed files with 44 additions and 7 deletions

View File

@@ -20,6 +20,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
+ [export] new export to Texy! markup
+ [lang] Finnish update, thanks to Jouni Kahkonen
+ [config] new parameter $cfg['CheckConfigurationPermissions']
+ [config] new parameter $cfg['Servers'][$i]['ShowDatabasesCommand']
+ rfe #1775288 [transformation] proper display if IP-address stored as INT
+ rfe #1758177 [core] Add the Geometry DataTypes
+ rfe #1741101, patch #1798184 UUID default for CHAR(36) PRIMARY KEY,

View File

@@ -49,6 +49,12 @@ require_once './libraries/List.class.php';
* @access protected
*/
var $_show_databases_disabled = false;
/**
* @var string command to retrieve databases from server
* @access protected
*/
var $_command = null;
/**
* Constructor
@@ -107,26 +113,30 @@ require_once './libraries/List.class.php';
* @uses $GLOBALS['errno']
* @param string $like_db_name usally a db_name containing wildcards
*/
function _retrieve($like_db_name = '')
function _retrieve($like_db_name = null)
{
if ($this->_show_databases_disabled) {
return array();
}
if (! empty($like_db_name)) {
$like = " LIKE '" . $like_db_name . "';";
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 {
$like = ";";
$command = $this->_command;
}
$database_list = PMA_DBI_fetch_result('SHOW DATABASES' . $like, null, null, $this->_db_link);
$database_list = PMA_DBI_fetch_result($command, null, null, $this->_db_link);
PMA_DBI_getError();
if ($GLOBALS['errno'] !== 0) {
// failed to get database list, try the control user
// (hopefully there is one and he has SHOW DATABASES right)
$this->_db_link = $this->_db_link_control;
$database_list = PMA_DBI_fetch_result('SHOW DATABASES' . $like, null, null, $this->_db_link);
$database_list = PMA_DBI_fetch_result($command, null, null, $this->_db_link);
PMA_DBI_getError();

View File

@@ -328,6 +328,32 @@ $cfg['Servers'][$i]['DisableIS'] = true;
*/
$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 wiht less information
*
* especialy when accessing database servers from ISPs chaning this command can
* result in a great speed improvement
*
* fasle 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
*
* example:
* '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';
/**
* Default server (0 = no default server)
*