From f1513b26786e5be3fbe6db96c6fda67fe60021cb Mon Sep 17 00:00:00 2001 From: "J.M" Date: Sun, 14 Apr 2013 15:32:34 +0200 Subject: [PATCH] Fix bug #3873 Can't copy table to target database if table exists there --- ChangeLog | 1 + libraries/Table.class.php | 4 ++-- libraries/operations.lib.php | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f21b59f07..39e9d01628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -105,6 +105,7 @@ underscore - bug #3860 Displayed git revision info is not set - bug #3871 Check referential integrity broken across databases - bug #3874 [export] No preselected option when exporting table +- bug #3873 Can't copy table to target database if table exists there 3.5.9.0 (not yet released) diff --git a/libraries/Table.class.php b/libraries/Table.class.php index 963f2958fc..a9f2c40ba7 100644 --- a/libraries/Table.class.php +++ b/libraries/Table.class.php @@ -840,8 +840,8 @@ class PMA_Table $sql_structure = PMA_SQP_formatHtml($parsed_sql, 'query_only'); // If table exists, and 'add drop table' is selected: Drop it! $drop_query = ''; - if (isset($GLOBALS['drop_if_exists']) - && $GLOBALS['drop_if_exists'] == 'true' + if (isset($_REQUEST['drop_if_exists']) + && $_REQUEST['drop_if_exists'] == 'true' ) { if (PMA_Table::isView($target_db, $target_table)) { $drop_query = 'DROP VIEW'; diff --git a/libraries/operations.lib.php b/libraries/operations.lib.php index 5c45607488..737c3642ed 100644 --- a/libraries/operations.lib.php +++ b/libraries/operations.lib.php @@ -541,11 +541,11 @@ function PMA_handleTheViews($views, $move, $db) $_error = false; // temporarily force to add DROP IF EXIST to CREATE VIEW query, // to remove stand-in VIEW that was created earlier - // ( $GLOBALS['drop_if_exists'] is used in moveCopy() ) - if (isset($GLOBALS['drop_if_exists'])) { - $temp_drop_if_exists = $GLOBALS['drop_if_exists']; + // ( $_REQUEST['drop_if_exists'] is used in moveCopy() ) + if (isset($_REQUEST['drop_if_exists'])) { + $temp_drop_if_exists = $_REQUEST['drop_if_exists']; } - $GLOBALS['drop_if_exists'] = 'true'; + $_REQUEST['drop_if_exists'] = 'true'; foreach ($views as $view) { $copying_succeeded = PMA_Table::moveCopy( @@ -556,10 +556,10 @@ function PMA_handleTheViews($views, $move, $db) break; } } - unset($GLOBALS['drop_if_exists']); + unset($_REQUEST['drop_if_exists']); if (isset($temp_drop_if_exists)) { // restore previous value - $GLOBALS['drop_if_exists'] = $temp_drop_if_exists; + $_REQUEST['drop_if_exists'] = $temp_drop_if_exists; } return $_error; }