The branch, master has been updated via 680cfbe726e52c016435683fec809d105954afa1 (commit) via 990820f5fac3ad741662419c923e2bda74097442 (commit) via 23389d2e4f9bce3e12def3ab479f376738c83216 (commit) via 36e1af721ef427214dcf4e276bdf247ebce4032b (commit) from ca9c30f1d60ad88ed1a0320dd231c54e866ab439 (commit)
- Log ----------------------------------------------------------------- commit 680cfbe726e52c016435683fec809d105954afa1 Author: Piotr Przybylski piotrprz@gmail.com Date: Fri Aug 5 22:39:16 2011 +0200
Server Synchronize: better layout for displayed queries
commit 990820f5fac3ad741662419c923e2bda74097442 Author: Piotr Przybylski piotrprz@gmail.com Date: Fri Aug 5 22:38:50 2011 +0200
Server Synchronize: fix a few cases of undefined variable warning
commit 23389d2e4f9bce3e12def3ab479f376738c83216 Author: Piotr Przybylski piotrprz@gmail.com Date: Fri Aug 5 22:38:10 2011 +0200
Server Synchronize: make it fully work on servers other than the first one
commit 36e1af721ef427214dcf4e276bdf247ebce4032b Author: Piotr Przybylski piotrprz@gmail.com Date: Fri Aug 5 22:36:12 2011 +0200
Server Synchronize: display semicolon after executed queries
-----------------------------------------------------------------------
Summary of changes: js/server_synchronize.js | 30 ++++++++++-------------------- libraries/server_synchronize.lib.php | 4 ++++ server_synchronize.php | 21 +++++++++++---------- 3 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/js/server_synchronize.js b/js/server_synchronize.js index 2cc0365..8425423 100644 --- a/js/server_synchronize.js +++ b/js/server_synchronize.js @@ -226,33 +226,23 @@ function showDetails(i, update_size, insert_size, remove_size, insert_index, rem */ function ApplySelectedChanges(token) { - var div = document.getElementById("list"); - var table = div.getElementsByTagName('table')[0]; - var table_body = table.getElementsByTagName('tbody')[0]; - // Get all the rows from the details table - var table_rows = table_body.getElementsByTagName('tr'); - var x = table_rows.length; - var i; /** Append the token at the beginning of the query string followed by Table_ids that shows that "Apply Selected Changes" button is pressed */ - var append_string = "?token="+token+"&Table_ids="+1; - for(i=0; i<x; i++){ - append_string += "&"; - append_string += i+"="+table_rows[i].id; + var params = { + token: $('#synchronize_form input[name=token]').val(), + server: $('#synchronize_form input[name=server]').val(), + checked: $('#delete_rows').prop('checked') ? 'true' : 'false', + Table_ids: 1 + }; + var $rows = $('#list tbody tr'); + for(var i = 0; i < $rows.length; i++) { + params[i] = $($rows[i]).attr('id'); }
- // Getting the value of checkbox delete_rows - var checkbox = document.getElementById("delete_rows"); - if (checkbox.checked){ - append_string += "&checked=true"; - } else { - append_string += "&checked=false"; - } //Appending the token and list of table ids in the URL - location.href += token; - location.href += append_string; + location.href += '?' + $.param(params); }
diff --git a/libraries/server_synchronize.lib.php b/libraries/server_synchronize.lib.php index 1d8bfab..eacae70 100644 --- a/libraries/server_synchronize.lib.php +++ b/libraries/server_synchronize.lib.php @@ -422,6 +422,7 @@ function PMA_updateTargetTables($table, $update_array, $src_db, $trg_db, $trg_li } } } + $query .= ';'; if ($display == true) { echo "<p>" . $query . "</p>"; } @@ -621,6 +622,7 @@ function PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, &$uncomm } } } + $Create_Table_Query .= ';'; if ($display == true) { echo '<p>' . $Create_Table_Query . '</p>'; } @@ -1040,6 +1042,7 @@ function PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables, &$s } } } + $query .= ';'; if ($check) { if ($display == true) { echo '<p>' . $query . '</p>'; @@ -1229,6 +1232,7 @@ function PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables, $source_ind $query .= " )"; } } + $query .= ';'; if ($display == true) { echo '<p>' . $query . '</p>'; } diff --git a/server_synchronize.php b/server_synchronize.php index faffd65..623681c 100644 --- a/server_synchronize.php +++ b/server_synchronize.php @@ -254,7 +254,7 @@ if ((isset($_REQUEST['submit_connect']))) { */ ?> <form name="synchronize_form" id="synchronize_form" method="post" action="server_synchronize.php"> - <?php PMA_generate_common_hidden_inputs('', ''); ?> + <?php echo PMA_generate_common_hidden_inputs('', ''); ?> <table width="40%"> <tr> <td> @@ -281,8 +281,9 @@ if ((isset($_REQUEST['submit_connect']))) { /** * Calculating the number of updates for each matching table */ - if (isset($update_array[$i]) && isset($update_array[$i][0]) && - isset($update_array[$i][0][$matching_tables_keys[$i][0]])) { + if (isset($update_array[$i]) && isset($update_array[$i][0]) + && !empty($matching_tables_keys[$i][0]) + && isset($update_array[$i][0][$matching_tables_keys[$i][0]])) { $num_of_updates = sizeof($update_array[$i]); } else { $num_of_updates = 0; @@ -290,8 +291,9 @@ if ((isset($_REQUEST['submit_connect']))) { /** * Calculating the number of insertions for each matching table */ - if (isset($insert_array[$i]) && isset($insert_array[$i][0]) && - isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) { + if (isset($insert_array[$i]) && isset($insert_array[$i][0]) + && !empty($matching_tables_keys[$i]) + && isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) { $num_of_insertions = sizeof($insert_array[$i]); } else { $num_of_insertions = 0; @@ -341,7 +343,7 @@ if ((isset($_REQUEST['submit_connect']))) { /** * Display the green button of data synchronization if there exists any data difference. */ - if (isset($update_array[$i]) || isset($insert_array[$i])) { + if ((isset($update_array[$i]) || isset($insert_array[$i])) && !empty($matching_tables_keys[$i])) { if (isset($update_array[$i][0][$matching_tables_keys[$i][0]]) || isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) { $btn_data_params = array($i, $num_of_updates, $num_of_insertions, null, null, null); } @@ -743,6 +745,7 @@ if (isset($_REQUEST['Table_ids'])) { } $rows[] = array( 'src_table_name' => $matching_tables[$i], + 'dst_table_name' => $matching_tables[$i], 'btn_type' => 'M', 'btn_structure' => $btn_structure_params, 'btn_data' => $btn_data_params @@ -945,9 +948,7 @@ if (isset($_REQUEST['synchronize_db'])) { /** * Displaying the queries. */ - echo '<h5>' . __('The following queries have been executed:') . '</h5>'; - echo '<div id="serverstatus" style = "overflow: auto; width: 1050px; height: 180px; - border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px"> '; + echo '<fieldset><legend>' . __('Executed queries') . '</legend>'; /** * Applying all sorts of differences for each matching table */ @@ -1018,7 +1019,7 @@ if (isset($_REQUEST['synchronize_db'])) { PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, true); } } - echo "</div>"; + echo "</fieldset>"; }
/**
hooks/post-receive