[Phpmyadmin-devel] PMA_DBI_get_dblist()

Hi, 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? Why should this check run if i have MySQL >= 4.0.2? at least, shouldn't it be written with && instead of ||: if (PMA_MYSQL_INT_VERSION < 40002 && !empty($GLOBALS['cfg']['Server']['hide_db'])) { so that the db-list gets only checked if MySQL < 4.0.2 AND the hide_db-list is empty -- Sebastian Mendel www.sebastianmendel.de

Sebastian Mendel schrieb:
Hi,
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?
Why should this check run if i have MySQL >= 4.0.2?
at least, shouldn't it be written with && instead of ||:
if (PMA_MYSQL_INT_VERSION < 40002 && !empty($GLOBALS['cfg']['Server']['hide_db'])) {
so that the db-list gets only checked if MySQL < 4.0.2 AND the hide_db-list is empty
and even more, i think this two things should handled completely independent - if i hide a single db i do not want to display all other db's not accessible. or is there something different written in the manual i can't find? -- Sebastian Mendel www.sebastianmendel.de

Sebastian Mendel a écrit :
Sebastian Mendel schrieb:
Hi,
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?
Why should this check run if i have MySQL >= 4.0.2?
I see no reason.
at least, shouldn't it be written with && instead of ||:
if (PMA_MYSQL_INT_VERSION < 40002 && !empty($GLOBALS['cfg']['Server']['hide_db'])) {
so that the db-list gets only checked if MySQL < 4.0.2 AND the hide_db-list is empty
and even more, i think this two things should handled completely independent - if i hide a single db i do not want to display all other db's not accessible. or is there something different written in the manual i can't find?
I agree, these two things should be handled independently. First, a loop for MySQL < 40002 that does the PMA_DBI_select_db() and unsets if the db cannot be selected. Then another loop for the hide case. Marc

Hi On Tue, 19 Sep 2006 10:38:41 +0200 Sebastian Mendel <lists@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

Michal Čihař schrieb:
Hi
On Tue, 19 Sep 2006 10:38:41 +0200 Sebastian Mendel <lists@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
yes, but 'USE DATABSE'-check is currently always done is have hidedbs - that is not necessary if i have MySQL > 4.0.2 ... but this is clear now
and make the execution faster):
of course! ;-) -- Sebastian Mendel www.sebastianmendel.de
participants (3)
-
Marc Delisle
-
Michal Čihař
-
Sebastian Mendel