(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'); if ($mult_btn == $strYes) { $message = sprintf($strDatabasesDropped, count($selected)); } else { $message = sprintf($strDatabasesDropped, 0); } // 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" . ( $GLOBALS['cfg']['MainPageIconic'] ? '' : '' ) . ( 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_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($current_db) . ';'); while ($row = PMA_DBI_fetch_assoc($res)) { $tmp_array['tbl_cnt']++; $tmp_array['data_sz'] += $row['Data_length']; $tmp_array['idx_sz'] += $row['Index_length']; } PMA_DBI_free_result($res); unset($res); } $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" . ($is_superuser || $cfg['AllowUserDropDatabase'] ? ' ' . "\n" : '') . ' ' . "\n"; if (!empty($dbstats)) { if (PMA_MYSQL_INT_VERSION >= 40101) { echo ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } if ($is_superuser) { echo ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; $total_calc = array( 'db_cnt' => 0, 'tbl_cnt' => 0, 'data_sz' => 0, 'idx_sz' => 0, 'tot_sz' => 0 ); $odd_row = false; foreach ( $statistics as $current ) { $odd_row = !$odd_row; 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)) { if (PMA_MYSQL_INT_VERSION >= 40101) { $current_collation = PMA_getDbCollation($current['db_name']); echo ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n"; } if ($is_superuser) { echo ' ' . "\n"; } echo ' ' . "\n"; } // end foreach ( $statistics as $current ) 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"; if (PMA_MYSQL_INT_VERSION >= 40101) { echo ' ' . "\n"; } echo ' ' . "\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) ? '0' : '1'); echo ' ' . "\n" . ' ' . "\n"; } echo ' ' . "\n" .'
 ' . "\n" . ' ' . "\n" . ' ' . $strDatabase . "\n" . ($sort_by == 'db_name' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . ' ' . $strCollation . '' . "\n" . ' ' . $strNumTables . "\n" . ($sort_by == 'tbl_cnt' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strData . "\n" . ($sort_by == 'data_sz' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strIndexes . "\n" . ($sort_by == 'idx_sz' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strTotalUC . "\n" . ($sort_by == 'tot_sz' ? ' ' . ($sort_order == 'asc' ? $strAscending : $strDescending) . '' . "\n" : '') . ' ' . "\n" . ' ' . ($cfg['PropertiesIconic'] ? ' ' : $strAction ) . "\n" . '
' . "\n"; if (PMA_MYSQL_INT_VERSION < 50002 || $current['db_name'] != 'information_schema') { echo ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n" . ' ' . htmlspecialchars($current['db_name']) . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . htmlspecialchars($current_collation) . "\n" . ' ' . "\n" . ' ' . $current['tbl_cnt'] . '' . $data_size . '' . $data_unit . '' . $idx_size . '' . $idx_unit . '' . $tot_size . '' . $tot_unit . '' . "\n" . ' '. "\n" . ' ' .($cfg['PropertiesIconic'] ? ' ' .$strCheckPrivs . ' ' : $strCheckPrivs ). "\n" . ' ' . "\n" . '
 ' . $strTotalUC . ': ' . $total_calc['db_cnt'] . '  ' . $total_calc['tbl_cnt'] . '' . $data_size . '' . $data_unit . '' . $idx_size . '' . $idx_unit . '' . $tot_size . '' . $tot_unit . ' 
' . "\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 ( $GLOBALS['cfg']['PropertiesIconic'] ) { // iconic view if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo '
' . "\n"; if ($is_superuser && empty($dbstats)) { echo ' ' . "\n"; } else if ($is_superuser && !empty($dbstats)) { echo ' ' . "\n"; } echo ' ' . "\n" . ' ' . "\n" . '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strDatabasesStatsEnable . "\n" . ' ' . "\n" . ' ' . "\n" . '
' . "\n" . ' ' . $strDatabasesStatsHeavyTraffic . "\n" . '
 
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . $strDatabasesStatsDisable . "\n" . ' ' . "\n" . ' ' . "\n" . '
 
' . "\n" . ' ' . ' ' . $strDropSelectedDatabases . ' ' . "\n" . '
 ' . "\n" . ' ' . "\n" . '
 
' . "\n"; } } else { // classic view if ($is_superuser || $cfg['AllowUserDropDatabase']) { echo '
' . "\n"; } } echo '
' . "\n"; } else { echo $strNoDatabases . "\n"; } /** * Create new database. */ if ( $GLOBALS['cfg']['PropertiesIconic'] ) { echo '' . "\n"; echo '' . "\n" . ' ' . "\n" . '
' . "\n" . ' ' . "\n" . ' ' . "\n"; } else { echo '
    ' . "\n"; echo '
  • ' . "\n"; } require('./libraries/display_create_database.lib.php'); if ( $GLOBALS['cfg']['PropertiesIconic'] ) { echo '
' . "\n"; } else { echo ' ' . "\n"; echo '' . "\n"; } /** * Sends the footer */ require_once('./footer.inc.php'); ?>