From 592d098050a57768a7edbc89f0a99d70d83bc31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sun, 2 Sep 2001 18:40:57 +0000 Subject: [PATCH] added a button to drop databases --- db_stats.php3 | 208 +++++++++++++++++++++++++++++++++-------------- images/arrow.gif | Bin 0 -> 1104 bytes 2 files changed, 148 insertions(+), 60 deletions(-) create mode 100644 images/arrow.gif diff --git a/db_stats.php3 b/db_stats.php3 index bb5ebd751..305e97775 100644 --- a/db_stats.php3 +++ b/db_stats.php3 @@ -2,13 +2,80 @@ /* $Id$ */ /** - * Gets the variables sent to this script, retains the db name that may have - * been defined as startup option and include a core library + * Gets the variables sent to this script and send headers */ require('./grab_globals.inc.php3'); +$js_to_run = 'functions.js'; require('./header.inc.php3'); +/* ---------------- The user requires some db to be dropped ---------------- */ + +if (!empty($submit) || isset($btnDrop)) { + + /** + * Confirmation form + */ + if (!empty($submit) && !empty($selected_db)) { + + // 1.1 Builds the query + $full_query = ''; + $drop_cnt = count($selected_db); + for ($i = 0; $i < $drop_cnt; $i++) { + $full_query .= 'DROP DATABASE ' . backquote(htmlspecialchars(urldecode($selected_db[$i]))) . ';
'; + } + + // 1.2 Displays the form + echo $strDoYouReally . ' :
' . "\n"; + echo '' . $full_query . ' ?
' . "\n"; + ?> +
+ + + ' . "\n"; + } + ?> + + +
+ + + 0) { } + /** * Displays the page */ @@ -114,8 +182,12 @@ if ($server > 0) { if ($num_dbs > 0) { // Defines the urls used to sort the table $common_url = 'db_stats.php3?lang=' . $lang . '&server=' . $server; - if (empty($sort_order)) { - $sort_order = ((empty($sort_by) || $sort_by == 'db_name') ? 'asc' : 'desc'); + if (empty($sort_by)) { + $sort_by = 'db_name'; + $sort_order = 'asc'; + } + else if (empty($sort_order)) { + $sort_order = (($sort_by == 'db_name') ? 'asc' : 'desc'); } $img_tag = ' ' . "\n" . ' ' @@ -126,7 +198,7 @@ if ($num_dbs > 0) { $url_sort[$i]['order'] = (($i == 0) ? 'asc' : 'desc'); $url_sort[$i]['img_tag'] = ''; } - if (empty($sort_by) || $sort_by == 'db_name') { + if ($sort_by == 'db_name') { $url_sort[0]['order'] = (($sort_order == 'asc') ? 'desc' : 'asc'); $url_sort[0]['img_tag'] = $img_tag; $col = 'key'; // used in 'pmaDbCmp()' @@ -148,35 +220,39 @@ if ($num_dbs > 0) { $col = 3; } ?> - - - - - - - - - + + + + +
  -   - -   - -   - -   - -   - -   - -   - -   - -   - -   -
+ + + + + + + + 0) { } } // end for - // Sorts the dbs arrays (already sorted if 'db_name' ascending order) - if (!empty($sort_by) - && !($sort_by == 'db_name' && $sort_order == 'asc')) { - uksort($dbs_array, 'pmaDbCmp'); - reset($dbs_array); - } + // Sorts the dbs arrays + uksort($dbs_array, 'pmaDbCmp'); + reset($dbs_array); // Displays the tables stats per database $i = 0; @@ -231,14 +304,16 @@ if ($num_dbs > 0) { list($idx_size, $idx_unit) = format_byte_down($dbs_array[$db_name][2], 3, 1); list($tot_size, $tot_unit) = format_byte_down($dbs_array[$db_name][3], 3, 1); - echo '' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo '' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; $i++; } // end while @@ -249,15 +324,25 @@ if ($num_dbs > 0) { list($idx_size, $idx_unit) = format_byte_down($total_array[2], 3, 1); list($tot_size, $tot_unit) = format_byte_down($total_array[3], 3, 1); - echo '' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo ' ' . "\n"; - echo '' . "\n"; - echo '
  +   + +   + +   + +   + +   + +   + +   + +   + +   + +   +
 ' . ($i + 1) . '  ' . htmlentities($db_name) . '  ' . $dbs_array[$db_name][0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
' . "\n"; + echo '   ' . "\n"; + echo '  ' . htmlentities($db_name) . '  ' . $dbs_array[$db_name][0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
  ' . $strSum . ': ' . $num_dbs . ' ' . $total_array[0] . '  ' . $data_size . ' ' . $data_unit . '  ' . $idx_size . ' ' . $idx_unit . '  ' . $tot_size . ' ' . $tot_unit . ' 
' . "\n"; + echo ' ' . "\n"; + echo '  ' . "\n"; + echo '  ' . $strSum . ': ' . $num_dbs . '' . "\n"; + echo '  ' . $total_array[0] . ' ' . "\n"; + echo '  ' . $data_size . ' ' . $data_unit . ' ' . "\n"; + echo '  ' . $idx_size . ' ' . $idx_unit . ' ' . "\n"; + echo '  ' . $tot_size . ' ' . $tot_unit . ' ' . "\n"; + echo ' ' . "\n\n"; + + echo ' ' . "\n"; + echo ' ' . "\n"; + echo ' ' . $strWithChecked . '' . "\n"; + echo ' ' . $strWithChecked . '  ' . "\n"; + echo ' ' . "\n"; + echo ' ' . "\n"; + + echo ' ' . "\n\n"; + + echo '' . "\n"; unset($total_array); } // end if ($num_dbs > 0) @@ -272,7 +357,10 @@ else { - - + +/** + * Displays the footer + */ +require('./footer.inc.php3'); +?> diff --git a/images/arrow.gif b/images/arrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..3716c54e10f25868582763b2394eaba7c19fc130 GIT binary patch literal 1104 zcmZ?wbhEHb)MHR%_|CxK=4$I^;~8x0?O_}2>E;#e<>MXf6B6RBkP-ds_c)s|JU zvZ5rab#mGAWtHouP3xMryleT!X)9)~*tTNFiqkV!9$&KU`ifI;cWjz`;>fZS*LK}_ zzT@q&}`Sq7CPkw#z;^nJf&%gh9{qx1|zkmNSi~`gU`2YVu zs=z3Zv=C7I$->CMFqJ_Eqz#lO*g5_)XmiSVY*=uxnL}7B=ER1DhuZ~|z2c zs}m+OF`<#WS6JO7VgqB!5kYPZlNAXS%{X1QaLsa9V0#j3`)? z?!+U=_0A;ggIn7aR&RwJ2c{&jvIz0{&DgMLm4lGYUavihWs2>rMyHf|CN?xgwdim# z%=mb1K?ehi&lTMr4h)Sfn&0?z1Q;9}S@;4@C|FM@RF$486J6ujP|(E0A!1??@bEx0 zD>qMr-vtInp2^&|1g&Dfgpa5 z0}l*xuT=