From 1fe0f5c0063072b07adf2758317073423cae8b4a Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 30 Apr 2005 12:02:43 +0000 Subject: [PATCH] bug #1192468, bookmarks copied too many times --- ChangeLog | 4 ++++ db_operations.php | 11 ++++++++++- libraries/tbl_move_copy.php | 8 ++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 215ea64a9..2902cec13 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-04-30 Marc Delisle + * db_operations.php, libraries/tbl_move_copy.php: + bug #1192468, bookmarks copied too many times + 2005-04-27 Marc Delisle * lang/finnish: update, thanks to Jouni Kahkonen * lang/russian: update, thanks to lobovich diff --git a/db_operations.php b/db_operations.php index eb28a9df5..b87c0d53c 100644 --- a/db_operations.php +++ b/db_operations.php @@ -6,7 +6,7 @@ require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); require_once('./libraries/mysql_charsets.lib.php'); /** - * Rename database + * Rename database or Copy database */ if (isset($db) && ((isset($db_rename) && $db_rename == 'true') || @@ -30,6 +30,15 @@ if (isset($db) && PMA_table_move_copy($db, $table, $newname, $table, isset($what) ? $what : 'data', $move); $sql_query = $back . $sql_query; } + + // Duplicate the bookmarks for this db (done once for each db) + if ($db != $newname) { + $get_fields = array('user','label','query'); + $where_fields = array('dbase' => $db); + $new_fields = array('dbase' => $newname); + PMA_duplicate_table_info('bookmarkwork', 'bookmark', $get_fields, $where_fields, $new_fields); + } + if ($move) { $local_query = 'DROP DATABASE ' . PMA_backquote($db) . ';'; $sql_query .= "\n" . $local_query; diff --git a/libraries/tbl_move_copy.php b/libraries/tbl_move_copy.php index 548841d9b..118342a65 100644 --- a/libraries/tbl_move_copy.php +++ b/libraries/tbl_move_copy.php @@ -328,12 +328,8 @@ function PMA_table_move_copy($source_db, $source_table, $target_db, $target_tabl } // end while } - if ($source_db != $target_db) { - $get_fields = array('user','label','query'); - $where_fields = array('dbase' => $source_db); - $new_fields = array('dbase' => $target_db); - PMA_duplicate_table_info('bookmarkwork', 'bookmark', $get_fields, $where_fields, $new_fields); - } + // duplicating the bookmarks must not be done here, but + // just once per db $get_fields = array('display_field'); $where_fields = array('db_name' => $source_db, 'table_name' => $source_table);