Drop multiple databases.
This commit is contained in:
@@ -3,6 +3,15 @@
|
||||
// vim: expandtab sw=4 ts=4 sts=4:
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the left frame has to be reloaded
|
||||
*/
|
||||
require('./libraries/grab_globals.lib.php3');
|
||||
if (!empty($drop_selected_dbs)) {
|
||||
$reload = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does the common work
|
||||
*/
|
||||
@@ -37,6 +46,32 @@ function PMA_dbCmp($a, $b)
|
||||
} // end of the 'PMA_dbCmp()' function
|
||||
|
||||
|
||||
/**
|
||||
* Drops multiple databases
|
||||
*/
|
||||
if (!empty($drop_selected_dbs)) {
|
||||
if (empty($selected_db)) {
|
||||
$message = $strNoDatabasesSelected;
|
||||
} else {
|
||||
$sql_query = array();
|
||||
while (list(, $current_db) = each($selected_db)) {
|
||||
$current_query = 'DROP DATABASE ' . PMA_backquote($current_db) . ';';
|
||||
$sql_query[] = $current_query;
|
||||
PMA_mysql_query($current_query, $userlink)
|
||||
// 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.
|
||||
PMA_availableDatabases();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays the links
|
||||
*/
|
||||
@@ -294,7 +329,13 @@ if (count($statistics) > 0) {
|
||||
. ' </a>' . "\n"
|
||||
. ' </b>' . "\n";
|
||||
}
|
||||
echo ' </li>' . "\n"
|
||||
echo ' </li><br />' . "\n"
|
||||
. ' <li>' . "\n"
|
||||
. ' <b>' . "\n"
|
||||
. ' ' . $strDropSelectedDatabases . "\n"
|
||||
. ' </b><br />' . "\n"
|
||||
. ' <input type="submit" name="drop_selected_dbs" value="' . $strGo . '" />' . "\n"
|
||||
. ' </li>' . "\n"
|
||||
. ' </ul>' . "\n"
|
||||
. '</form>' . "\n";
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user