3 # Drop an existing database
5 require './postgresql-lib.pl';
7 &error_setup($text{'ddrop_err'});
8 &can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
11 &execute_sql_logged($config{'basedb'}, "drop database \"$in{'db'}\"");
12 &webmin_log("delete", "db", $in{'db'});
16 # Ask the user if he is sure..
17 &ui_print_header(undef, $text{'ddrop_title'}, "");
18 @tables = &list_tables($in{'db'});
20 foreach $t (@tables) {
21 $d = &execute_sql($in{'db'}, "select count(*) from $t");
22 $rows += $d->{'data'}->[0]->[0];
25 print "<center><b>",&text('ddrop_rusure', "<tt>$in{'db'}</tt>",
26 scalar(@tables), $rows),"\n";
27 print $text{'ddrop_mysql'},"\n" if ($in{'db'} eq $config{'basedb'});
29 print "<form action=drop_dbase.cgi>\n";
30 print "<input type=hidden name=db value='$in{'db'}'>\n";
31 print "<input type=submit name=confirm value='$text{'ddrop_ok'}'>\n";
32 print "</form></center>\n";
33 &ui_print_footer("edit_dbase.cgi?db=$in{'db'}", $text{'dbase_return'},
34 "", $text{'index_return'});