diff --git a/db_stats.php3 b/db_stats.php3 index b632e1e3a..718090d24 100644 --- a/db_stats.php3 +++ b/db_stats.php3 @@ -80,56 +80,60 @@ header('Content-Type: text/html; charset=' . $charset); -

- - +

+ - +

-

+

- + + - - - - - + + + + + 1) { - $selected_db = 0; - $tot_tables = 0; - $big_tot_all = 0; - $big_tot_idx = 0; + $selected_db = 0; + $tot_tables = 0; + $big_tot_all = 0; + $big_tot_idx = 0; $big_tot_data = 0; - // Gets the tables list per database + // Gets and displays the tables stats per database for ($i = 0; $i < $num_dbs; $i++) { - $db = $dblist[$i]; - $j = $i + 2; - $bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo; + $db = $dblist[$i]; + $j = $i + 2; + $bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo; if (!empty($db_start) && $db == $db_start) { - $selected_db = $j; + $selected_db = $j; } - $tables = @mysql_list_tables($db); - $num_tables = @mysql_numrows($tables); - $tot_tables += $num_tables; - $common_url_query = 'lang=' . $lang - . '&server=' . urlencode($server) - . '&db=' . urlencode($db); + $tables = @mysql_list_tables($db); + $num_tables = @mysql_numrows($tables); + $tot_tables += $num_tables; + $common_url_query = 'lang=' . $lang + . '&server=' . urlencode($server) + . '&db=' . urlencode($db); - // get size of data and indexes + // Gets size of data and indexes - $db_clean = backquote($db); - $tot_data = 0; $tot_idx = 0; $tot_all = 0; - $result = mysql_query("SHOW TABLE STATUS FROM $db_clean") or mysql_die(); - if (mysql_num_rows($result)) { - while ($row = mysql_fetch_array($result)) { - $tot_data += $row['Data_length']; - $tot_idx += $row['Index_length']; - } + $db_clean = backquote($db); + $tot_data = 0; + $tot_idx = 0; + $tot_all = 0; + $result = mysql_query('SHOW TABLE STATUS FROM ' . $db_clean) or mysql_die(); + if (mysql_num_rows($result)) { + while ($row = mysql_fetch_array($result)) { + $tot_data += $row['Data_length']; + $tot_idx += $row['Index_length']; + } $tot_all = $tot_data + $tot_idx; $big_tot_all += $tot_all; $big_tot_idx += $tot_idx; @@ -137,36 +141,37 @@ if ($num_dbs > 1) { } list($tot_data_format,$unit_data) = format_byte_down($tot_data,3,1); - list($tot_idx_format,$unit_idx) = format_byte_down($tot_idx,3,1); - list($tot_all_format,$unit_all) = format_byte_down($tot_all,3,1); - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - } + list($tot_idx_format,$unit_idx) = format_byte_down($tot_idx,3,1); + list($tot_all_format,$unit_all) = format_byte_down($tot_all,3,1); + echo '' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo '' . "\n"; + } // end for + // Gets and displays the server stats list($tot_data_format,$unit_data) = format_byte_down($big_tot_data,3,1); - list($tot_idx_format,$unit_idx) = format_byte_down($big_tot_idx,3,1); - list($tot_all_format,$unit_all) = format_byte_down($big_tot_all,3,1); + list($tot_idx_format,$unit_idx) = format_byte_down($big_tot_idx,3,1); + list($tot_all_format,$unit_all) = format_byte_down($big_tot_all,3,1); - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - echo "
          
" . urlencode($db) . " $num_tables $tot_data_format $unit_data $tot_idx_format $unit_idx $tot_all_format $unit_all
 ' . urlencode($db) . '  ' . $num_tables . '  ' . $tot_data_format . ' ' . $unit_data . '  ' . $tot_idx_format . ' ' . $unit_idx . '  ' . $tot_all_format . ' ' . $unit_all . ' 
" . $strSum . " $tot_tables $tot_data_format $unit_data $tot_idx_format $unit_idx $tot_all_format $unit_all
"; + echo '' . "\n"; + echo '  ' . $strSum . ' ' . "\n"; + echo '  ' . $tot_tables . ' ' . "\n"; + echo '  ' . $tot_data_format . ' ' . $unit_data . ' ' . "\n"; + echo '  ' . $tot_idx_format . ' ' . $unit_idx . ' ' . "\n"; + echo '  ' . $tot_all_format . ' ' . $unit_all . ' ' . "\n"; + echo '' . "\n"; + echo '' . "\n"; } // end if ($num_dbs == 1) + else { - echo "\n"; - echo '

' . $strNoDatabases . '

'; + echo "\n" . '' . "\n"; + echo '

  ' . $strNoDatabases . '

'; } // end if ($num_dbs == 0) echo "\n"; ?>