diff --git a/ChangeLog b/ChangeLog index 61093ae3e4..af4927a65c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -77,6 +77,7 @@ explanation - bug #4790 DROP TABLE/VIEW IF EXISTS are not tracked - bug Compatibility with central columns of version 4.4 - bug #4758 Firefox with auth_type to http with multiple server doesn't work anymore +- bug #4789 Views aren't dropped when copying a database 4.3.11.1 (2015-03-04) - bug [security] Risk of BREACH attack, see PMASA-2015-1 diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index c94e79251c..f54330098d 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -361,6 +361,20 @@ function PMA_getViewsAndCreateSqlViewStandIn( // first all the views are collected and a stand-in is created // the real views are created after the tables if (PMA_Table::isView($db, $each_table)) { + + // If view exists, and 'add drop view' is selected: Drop it! + if ($_REQUEST['what'] != 'nocopy' + && isset($_REQUEST['drop_if_exists']) + && $_REQUEST['drop_if_exists'] == 'true' + ) { + $drop_query = 'DROP VIEW IF EXISTS ' + . PMA_Util::backquote($_REQUEST['newname']) . '.' + . PMA_Util::backquote($each_table); + $GLOBALS['dbi']->query($drop_query); + + $GLOBALS['sql_query'] .= "\n" . $drop_query . ';'; + } + $views[] = $each_table; // Create stand-in definition to resolve view dependencies $sql_view_standin = $export_sql_plugin->getTableDefStandIn(