(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) || isset($query_type)) && ($is_superuser || $cfg['AllowUserDropDatabase'])) { if (empty($selected_db) && ! (isset($query_type) && !empty($selected))) { $message = $strNoDatabasesSelected; } else { $action = 'server_databases.php'; $submit_mult = 'drop_db' ; $err_url = 'server_databases.php?' . PMA_generate_common_url(); require('./mult_submits.inc.php'); $message = sprintf($strDatabasesDropped, count($selected)); // we need to reload the database list now. PMA_availableDatabases(); $reload = 1; } } /** * Displays the links */ require('./server_links.inc.php'); /** * 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) { echo $strNoPrivileges . "\n"; require_once('./footer.inc.php'); } /** * Prepares the statistics */ $statistics = array(); foreach($dblist AS $current_db) { $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" . ($is_superuser || $cfg['AllowUserDropDatabase'] ? ' ' . "\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"; } if ($is_superuser) { echo ' ' . "\n"; } echo ' ' . "\n"; $useBgcolorOne = TRUE; $total_calc = array( 'db_cnt' => 0, 'tbl_cnt' => 0, 'data_sz' => 0, 'idx_sz' => 0, 'tot_sz' => 0 ); foreach ($statistics as $current) { 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"; if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo ' ' . "\n"; } echo ' ' . "\n"; if (!empty($dbstats)) { echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } if ($is_superuser) { echo ' ' . "\n"; } echo ' ' . "\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"; } if ($is_superuser || $cfg['AllowUserDropDatabase']) { $common_url_query = PMA_generate_common_url() . '&sort_by=' . $sort_by . '&sort_order=' . $sort_order . '&dbstats=' . (empty($dbstats) ? '10' : '3'); echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } echo '
 ' . "\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"; unset($data_size); unset($data_unit); unset($idx_size); unset($idx_unit); unset($tot_size); unset($tot_unit); if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo ' ' . "\n"; } echo '
' . "\n"; } else { echo $strNoDatabases . "\n"; } /** * Sends the footer */ require_once('./footer.inc.php'); ?>