Add support for hiding databases (RFE #1372865).

This commit is contained in:
Michal Čihař
2005-12-16 13:21:00 +00:00
parent a7d95ddfbb
commit fc270335cf
5 changed files with 18 additions and 4 deletions

View File

@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2005-12-16 Michal Čihař <michal@cihar.com>
* Documentation.html, libraries/common.lib.php,
libraries/config.default.php, libraries/database_interface.lib.php: Add
support for hiding databases (RFE #1372865).
2005-12-14 Sebastian Mendel <cybot_tm@users.sourceforge.net> 2005-12-14 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/Config.class.php: * libraries/Config.class.php:
- added check is_readable for user config file - added check is_readable for user config file

View File

@@ -648,6 +648,14 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON &lt;pma_db&gt;.* TO 'pma'@'localhost';
order. order.
</dd> </dd>
<dt>
<b><a name="cfg_Servers_hide_db"></a>$cfg['Servers'][$i]['hide_db']</b> string
</dt>
<dd>
Regullar expression for hiding some databases. This only hides them
from listing, but user is still able to access them.
</dd>
<dt><b><a name="cfg_Servers_verbose"></a>$cfg['Servers'][$i]['verbose']</b> string</dt> <dt><b><a name="cfg_Servers_verbose"></a>$cfg['Servers'][$i]['verbose']</b> string</dt>
<dd> <dd>
Only useful when using phpMyAdmin with multiple server entries. If set, Only useful when using phpMyAdmin with multiple server entries. If set,

View File

@@ -988,7 +988,7 @@ if (!defined('PMA_MINIMUM_COMMON')) {
// authentification process -> gets the available databases list // authentification process -> gets the available databases list
if (count($dblist)) { if (count($dblist)) {
foreach ($dblist as $key => $db) { foreach ($dblist as $key => $db) {
if (!@PMA_DBI_select_db($db)) { if (!@PMA_DBI_select_db($db, $link) || (!empty($GLOBALS['cfg']['Server']['hide_db']) && preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db))) {
unset($dblist[$key]); unset($dblist[$key]);
} // end if } // end if
} // end for } // end for

View File

@@ -75,6 +75,7 @@ $cfg['Servers'][$i]['password'] = ''; // MySQL password (only need
$cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only $cfg['Servers'][$i]['only_db'] = ''; // If set to a db-name, only
// this db is displayed in left frame // this db is displayed in left frame
// It may also be an array of db-names, where sorting order is relevant. // It may also be an array of db-names, where sorting order is relevant.
$cfg['Servers'][$i]['hide_db'] = ''; // Database name to be hidden from listings
$cfg['Servers'][$i]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname $cfg['Servers'][$i]['verbose'] = ''; // Verbose name for this host - leave blank to show the hostname
$cfg['Servers'][$i]['pmadb'] = ''; // Database used for Relation, Bookmark and PDF Features $cfg['Servers'][$i]['pmadb'] = ''; // Database used for Relation, Bookmark and PDF Features

View File

@@ -176,9 +176,9 @@ function PMA_DBI_get_dblist($link = null)
// Before MySQL 4.0.2, SHOW DATABASES could send the // Before MySQL 4.0.2, SHOW DATABASES could send the
// whole list, so check if we really have access: // whole list, so check if we really have access:
if ( PMA_MYSQL_INT_VERSION < 40002 ) { if (PMA_MYSQL_INT_VERSION < 40002 || !empty($GLOBALS['cfg']['Server']['hide_db'])) {
foreach ($dbs_array as $key => $db) { foreach ($dbs_array as $key => $db) {
if ( ! PMA_DBI_select_db( $db, $link ) ) { if (!@PMA_DBI_select_db($db, $link) || (!empty($GLOBALS['cfg']['Server']['hide_db']) && preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db))) {
unset( $dbs_array[$key] ); unset( $dbs_array[$key] );
} }
} }