Add confirmation when dropping databases

This commit is contained in:
Michal Čihař
2003-05-12 18:57:24 +00:00
parent da61b429b2
commit 4b6342c71c
3 changed files with 17 additions and 17 deletions

View File

@@ -16,6 +16,8 @@ $Source$
2003-05-12 Michal Cihar <nijel@users.sourceforge.net> 2003-05-12 Michal Cihar <nijel@users.sourceforge.net>
* index.php3: Better fix for #736003. * index.php3: Better fix for #736003.
* libraries/common.lib.php3: Light tabs were displayed wrong, bug #736590. * libraries/common.lib.php3: Light tabs were displayed wrong, bug #736590.
* mult_submits.inc.php3, server_databases.php: Add confirmation when
dropping databases (bug #736238).
2003-05-11 Michal Cihar <nijel@users.sourceforge.net> 2003-05-11 Michal Cihar <nijel@users.sourceforge.net>
* Documentation.html, config.inc.php3, * Documentation.html, config.inc.php3,

View File

@@ -19,6 +19,9 @@ if (!empty($submit_mult)
} else { } else {
$selected = $selected_tbl; $selected = $selected_tbl;
switch ($submit_mult) { switch ($submit_mult) {
case 'drop_db':
$what = 'drop_db';
break;
case $strDrop: case $strDrop:
$what = 'drop_tbl'; $what = 'drop_tbl';
break; break;
@@ -70,7 +73,7 @@ if (!empty($submit_mult) && !empty($what)) {
$url_query .= '&amp;goto=tbl_properties.php3&amp;back=tbl_properties.php3'; $url_query .= '&amp;goto=tbl_properties.php3&amp;back=tbl_properties.php3';
include('./tbl_properties_table_info.php3'); include('./tbl_properties_table_info.php3');
} }
else { elseif (!empty($db)) {
include('./db_details_common.php3'); include('./db_details_common.php3');
include('./db_details_db_info.php3'); include('./db_details_db_info.php3');
} }
@@ -131,6 +134,8 @@ if (!empty($submit_mult) && !empty($what)) {
echo PMA_generate_common_hidden_inputs($db); echo PMA_generate_common_hidden_inputs($db);
} else if (strpos(' ' . $action, 'tbl_properties') == 1) { } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
echo PMA_generate_common_hidden_inputs($db,$table); echo PMA_generate_common_hidden_inputs($db,$table);
} else {
echo PMA_generate_common_hidden_inputs();
} }
for ($i = 0; $i < $selected_cnt; $i++) { for ($i = 0; $i < $selected_cnt; $i++) {
echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n"; echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
@@ -210,6 +215,7 @@ else if ($mult_btn == $strYes) {
&& $query_type != 'analyze_tbl' && $query_type != 'analyze_tbl'
&& $query_type != 'optimize_tbl' && $query_type != 'optimize_tbl'
&& $query_type != 'check_tbl') { && $query_type != 'check_tbl') {
$sql_query .= $a_query . ';' . "\n"; $sql_query .= $a_query . ';' . "\n";
if ($query_type != 'drop_db') { if ($query_type != 'drop_db') {

View File

@@ -54,23 +54,15 @@ if ($server > 0 && empty($dblist)) {
/** /**
* Drops multiple databases * Drops multiple databases
*/ */
if (!empty($drop_selected_dbs) && ($is_superuser || $cfg['AllowUserDropDatabase'])) { if ((!empty($drop_selected_dbs) || isset($query_type)) && ($is_superuser || $cfg['AllowUserDropDatabase'])) {
if (empty($selected_db)) { if (empty($selected_db) && ! (isset($query_type) && !empty($selected))) {
$message = $strNoDatabasesSelected; $message = $strNoDatabasesSelected;
} else { } else {
$sql_query = array(); $action = 'server_databases.php3';
while (list(, $current_db) = each($selected_db)) { $submit_mult = 'drop_db' ;
$current_query = 'DROP DATABASE ' . PMA_backquote($current_db) . ';'; $err_url = 'server_databases.php3?' . PMA_generate_common_url();
$sql_query[] = $current_query; include('./mult_submits.inc.php3');
PMA_mysql_query($current_query, $userlink) $message = sprintf($strDatabasesDropped, count($selected));
// 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. // we need to reload the database list now.
PMA_availableDatabases(); PMA_availableDatabases();
$reload = 1; $reload = 1;
@@ -369,4 +361,4 @@ if (count($statistics) > 0) {
*/ */
require('./footer.inc.php3'); require('./footer.inc.php3');
?> ?>