(int)$b[$sort_by] ? 1 : -1); } } // end of the 'PMA_dbCmp()' function /** * Gets the databases list - if it has not been built yet */ if ($server > 0 && empty($dblist)) { PMA_availableDatabases(); } /** * Drops multiple databases */ if (!empty($drop_selected_dbs)) { if (empty($selected_db)) { $message = $strNoDatabasesSelected; } else { $sql_query = array(); while (list(, $current_db) = each($selected_db)) { $current_query = 'DROP DATABASE ' . PMA_backquote($current_db) . ';'; $sql_query[] = $current_query; PMA_mysql_query($current_query, $userlink) // rabus: in case of an error, we display the full query in // order to let the user know which databases have already been // dropped. or PMA_mysqlDie(PMA_mysql_error($userlink), join("\n", $sql_query)); } // PMA_showMessage() needs a string... $sql_query = join("\n", $sql_query); $message = sprintf($strDatabasesDropped, count($selected_db)); // we need to reload the database list now. PMA_availableDatabases(); } } /** * Displays the links */ require('./server_links.inc.php3'); /** * Displays the sub-page heading */ echo '

' . "\n" . ' ' . (empty($dbstats) ? $strDatabases : $strDatabasesStats) . "\n" . '

' . "\n"; /** * Checks if the user is allowed to do what he tries to... */ if (!empty($dbstats) && (!$is_superuser || PMA_MYSQL_INT_VERSION < 32303)) { echo $strNoPrivileges . "\n"; include('./footer.inc.php3'); exit; } /** * Prepares the statistics */ $statistics = array(); while (list(, $current_db) = each($dblist)) { $tmp_array = array( 'db_name' => $current_db, 'tbl_cnt' => 0, 'data_sz' => 0, 'idx_sz' => 0, 'tot_sz' => 0 ); if (!empty($dbstats)) { $res = PMA_mysql_query('SHOW TABLE STATUS FROM ' . PMA_backquote($current_db) . ';', $userlink) or PMA_mysqlDie(PMA_mysql_error($userlink), 'SHOW TABLE STATUS FROM ' . PMA_backquote($current_db) . ';'); while ($row = PMA_mysql_fetch_array($res, MYSQL_ASSOC)) { $tmp_array['tbl_cnt']++; $tmp_array['data_sz'] += $row['Data_length']; $tmp_array['idx_sz'] += $row['Index_length']; } } $tmp_array['tot_sz'] = $tmp_array['data_sz'] + $tmp_array['idx_sz']; $statistics[] = $tmp_array; } // avoids 'undefined index' errors if (empty($sort_by)) { $sort_by = 'db_name'; } if (empty($sort_order)) { if ($sort_by == 'db_name') { $sort_order = 'asc'; } else { $sort_order = 'desc'; } } // sorts the array usort($statistics, 'PMA_dbCmp'); /** * Displays the page */ if (count($statistics) > 0) { echo '
' . "\n" . PMA_generate_common_hidden_inputs('', '', 1) . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } else { echo "\n" . ' ' . "\n" . ' ' . $strDatabase . "\n" . ($sort_by == 'db_name' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n"; $useBgcolorOne = TRUE; $total_calc = array( 'db_cnt' => 0, 'tbl_cnt' => 0, 'data_sz' => 0, 'idx_sz' => 0, 'tot_sz' => 0 ); while (list(, $current) = each($statistics)) { list($data_size, $data_unit) = PMA_formatByteDown($current['data_sz'], 3, 1); list($idx_size, $idx_unit) = PMA_formatByteDown($current['idx_sz'], 3, 1); list($tot_size, $tot_unit) = PMA_formatByteDown($current['tot_sz'], 3, 1); $total_calc['db_cnt']++; $total_calc['tbl_cnt'] += $current['tbl_cnt']; $total_calc['data_sz'] += $current['data_sz']; $total_calc['idx_sz'] += $current['idx_sz']; $total_calc['tot_sz'] += $current['tot_sz']; echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; if (!empty($dbstats)) { echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n"; $useBgcolorOne = !$useBgcolorOne; } // end while if (!empty($dbstats)) { list($data_size, $data_unit) = PMA_formatByteDown($total_calc['data_sz'], 3, 1); list($idx_size, $idx_unit) = PMA_formatByteDown($total_calc['idx_sz'], 3, 1); list($tot_size, $tot_unit) = PMA_formatByteDown($total_calc['tot_sz'], 3, 1); echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } $common_url_query = PMA_generate_common_url() . '&sort_by=' . $sort_by . '&sort_order=' . $sort_order . '&dbstats=' . (empty($dbstats) ? '10' : '3'); echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . '
 ' . "\n" . '  '; if (empty($dbstats)) { echo $strDatabase . "\n" . ' ' . $strAscending . '' . "\n" . '  ' . "\n" . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . ' ' . $strNumTables . "\n" . ($sort_by == 'tbl_cnt' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . ' ' . $strData . "\n" . ($sort_by == 'data_sz' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . ' ' . $strIndexes . "\n" . ($sort_by == 'idx_sz' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . ' ' . $strTotalUC . "\n" . ($sort_by == 'tot_sz' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . '  ' . "\n" . ' ' . "\n" . '  ' . $strAction . ' ' . "\n" . '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . htmlspecialchars($current['db_name']) . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $current['tbl_cnt'] . "\n" . ' ' . "\n" . ' ' . $data_size . "\n" . ' ' . "\n" . ' ' . $data_unit . "\n" . ' ' . "\n" . ' ' . $idx_size . "\n" . ' ' . "\n" . ' ' . $idx_unit . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $tot_size . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $tot_unit . "\n" . ' ' . "\n" . ' ' . "\n" . ' '. "\n" . ' ' . $strCheckPrivs . "\n" . ' ' . "\n" . '
 ' . "\n" . '  ' . $strTotalUC . ': ' . $total_calc['db_cnt'] . ' ' . "\n" . ' ' . "\n" . '  ' . $total_calc['tbl_cnt'] . ' ' . "\n" . ' ' . "\n" . '  ' . $data_size . "\n" . ' ' . "\n" . ' ' . $data_unit . ' ' . "\n" . ' ' . "\n" . '  ' . $idx_size . "\n" . ' ' . "\n" . ' ' . $idx_unit . ' ' . "\n" . ' ' . "\n" . '  ' . $tot_size . "\n" . ' ' . "\n" . ' ' . $tot_unit . ' ' . "\n" . '  
' . "\n" . ' ' . $strWithChecked . '' . "\n" . ' ' . "\n" . ' ' . $strCheckAll . ' ' . "\n" . '  / ' . "\n" . ' ' . "\n" . ' ' . $strUncheckAll . ' ' . "\n" . '
' . "\n" . ' ' . "\n" . '
' . "\n"; } else { echo $strNoDatabases . "\n"; } /** * Sends the footer */ require('./footer.inc.php3'); ?>