[Phpmyadmin-devel] PMA_DBI_get_dblist()
Michal Čihař
michal at cihar.com
Tue Sep 19 14:00:41 CEST 2006
Hi
On Tue, 19 Sep 2006 10:38:41 +0200
Sebastian Mendel <lists at sebastianmendel.de> wrote:
> if (PMA_MYSQL_INT_VERSION < 40002 ||
> !empty($GLOBALS['cfg']['Server']['hide_db'])) {
>
> if the above comes true every DB is checked with 'USE dB' for access,
> Why?
Because the loop does two independent things:
- Verify that we can access the database for MySQL < 4.0.2
- Remove databases matching hide_db
Feel free to change it to separate loops to avoid confusion (and make
the execution faster):
if (PMA_MYSQL_INT_VERSION < 40002) {
foreach ($dbs_array as $key => $db) {
if (!@PMA_DBI_select_db($db, $link)) {
unset( $dbs_array[$key] );
}
}
// re-index values
$dbs_array = array_values( $dbs_array );
}
if (!empty($GLOBALS['cfg']['Server']['hide_db'])) {
foreach ($dbs_array as $key => $db) {
if (preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db)) {
unset( $dbs_array[$key] );
}
}
// re-index values
$dbs_array = array_values( $dbs_array );
}
--
Michal Čihař | http://cihar.com | http://blog.cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20060919/a5508794/attachment.sig>
More information about the Developers
mailing list