[Phpmyadmin-devel] Pbs with left.php3

Loïc loic-div at ifrance.com
Wed Aug 22 12:21:15 CEST 2001


Hi All!

Well the current left.php3 script is not really optimized: it always use
mysql_list_dbs (even if $cfgServers[n]['only_db'] is set in order to
ensure these db trully exists) and this query may requires a huge
amount of memory if you're an ISP for example.
I've actaully done some tests with the ISP I suscribed to... and this
query make fails left.php3 indeed.

So I've rewritten a bit this script but I would like some of you to test
it before I submit this new version.

Lines 21 to 52 have been replaced by:

--- new code starts here ---
if ($server > 0) {
    $num_dbs = count($dblist);
    // 1. $cfgServers[n]['only_db'] exists -> gets the valid databases list
    if ($num_dbs) {
        $true_dblist           = array();
        for ($i = 0; $i < $num_dbs; $i++) {
            $dblink = @mysql_select_db($dblist[$i]);
            if ($dblink) {
                $true_dblist[] = $dblist[$i];
            } // end if
        } // end for
        unset($dblist);
        $dblist  = $true_dblist;
        unset($true_dblist);
        $num_dbs = count($dblist);
    } // end if
    // 2. no $cfgServers[n]['only_db']
    else {
        $dbs     = mysql_list_dbs() or mysql_die();
        $num_dbs = @mysql_num_rows($dbs);
        for ($i = 0; $i < $num_dbs; $i++) {
            $dblist[] = mysql_dbname($dbs, $i);
        } // end for
    } // end else
} else {
    $num_dbs = 0;
}
--- end of new code ---

Greetz,
Loïc

 
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif






More information about the Developers mailing list