3 /* vim: set expandtab sw=4 ts=4 sts=4: */
12 require_once './libraries/common.inc.php';
15 * Does the common work
17 $GLOBALS['js_include'][] = 'server_synchronize.js';
18 require_once './libraries/server_common.inc.php';
21 * Contains all the functions specific to synchronization
23 require './libraries/server_synchronize.lib.php';
26 * Increases the time limit up to the configured maximum
28 @set_time_limit
($cfg['ExecTimeLimit']);
33 require './libraries/server_links.inc.php';
36 * Enables warnings on the page
38 //$cfg['Error_Handler']['display'] = true;
39 //$cfg['Error_Handler']['gather'] = true;
42 * Save the value of token generated for this page
44 if (isset($_REQUEST['token'])) {
45 $_SESSION['token'] = $_REQUEST['token'];
48 // variable for code saving
49 $cons = array ("src", "trg");
52 * Displays the page when 'Go' is pressed
55 if ((isset($_REQUEST['submit_connect']))) {
56 foreach ($cons as $con) {
57 $
{"{$con}_host"} = $_REQUEST[$con . '_host'];
58 $
{"{$con}_username"} = $_REQUEST[$con . '_username'];
59 $
{"{$con}_password"} = $_REQUEST[$con . '_pass'];
60 $
{"{$con}_port"} = $_REQUEST[$con . '_port'];
61 $
{"{$con}_socket"} = $_REQUEST[$con . '_socket'];
62 $
{"{$con}_db"} = $_REQUEST[$con . '_db'];
63 $
{"{$con}_type"} = $_REQUEST[$con . '_type'];
65 if ($
{"{$con}_type"} == 'cur') {
66 $
{"{$con}_connection"} = null;
67 $
{"{$con}_server"} = null;
68 $
{"{$con}_db"} = $_REQUEST[$con . '_db_sel'];
72 if (isset($
{"{$con}_socket"}) && ! empty($
{"{$con}_socket"})) {
73 $
{"{$con}_server"}['socket'] = $
{"{$con}_socket"};
75 $
{"{$con}_server"}['host'] = $
{"{$con}_host"};
76 if (isset($
{"{$con}_port"})
77 && ! empty($
{"{$con}_port"})
78 && ((int)$
{"{$con}_port"} * 1) > 0
80 $
{"{$con}_server"}['port'] = (int)$
{"{$con}_port"};
84 $
{"{$con}_connection"} = PMA_DBI_connect($
{"{$con}_username"},
85 $
{"{$con}_password"}, $is_controluser = false,
86 $
{"{$con}_server"}, $auxiliary_connection = true);
87 } // end foreach ($cons as $con)
89 if ((! $src_connection && $src_type != 'cur')
90 ||
(! $trg_connection && $trg_type != 'cur')
93 * Displays the connection error string if
94 * connections are not established
97 echo '<div class="error">';
98 if (! $src_connection && $src_type != 'cur') {
99 echo __('Could not connect to the source') . '<br />';
101 if (! $trg_connection && $trg_type != 'cur') {
102 echo __('Could not connect to the target');
105 unset($_REQUEST['submit_connect']);
109 * Creating the link object for both source and target databases and
110 * selecting the source and target databases using these links
112 foreach ($cons as $con) {
113 if ($
{"{$con}_connection"} != null) {
114 $
{"{$con}_link"} = PMA_DBI_connect($
{"{$con}_username"},
115 $
{"{$con}_password"}, $is_controluser = false, $
{"{$con}_server"});
117 $
{"{$con}_link"} = null;
119 $
{"{$con}_db_selected"} = PMA_DBI_select_db($
{"{$con}_db"}, $
{"{$con}_link"});
120 $
{"{$con}_version"} = PMA_DBI_fetch_value('SELECT VERSION()', 0, 0, $
{"{$con}_link"});
121 $
{"{$con}_is_drizzle"} = (bool)preg_match('/\d{4}\./', $
{"{$con}_version"});
122 } // end foreach ($cons as $con)
124 if (($src_db_selected != 1) ||
($trg_db_selected != 1)) {
126 * Displays error string if the database(s) did not exist
128 echo '<div class="error">';
129 if ($src_db_selected != 1) {
130 echo sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($src_db));
132 if ($trg_db_selected != 1) {
133 echo sprintf(__('\'%s\' database does not exist.'), htmlspecialchars($trg_db));
136 unset($_REQUEST['submit_connect']);
138 } else if (($src_db_selected == 1) && ($trg_db_selected == 1)) {
141 * Using PMA_DBI_get_tables() to get all the tables
142 * from target and source databases.
144 $src_tables = PMA_DBI_get_tables($src_db, $src_link);
145 $source_tables_num = sizeof($src_tables);
147 $trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
148 $target_tables_num = sizeof($trg_tables);
151 * initializing arrays to save matching and non-matching
152 * table names from target and source databases.
154 $unmatched_num_src = 0;
155 $source_tables_uncommon = array();
156 $unmatched_num_trg = 0;
157 $target_tables_uncommon = array();
158 $matching_tables = array();
159 $matching_tables_num = 0;
162 * Using PMA_getMatchingTables to find which of the tables' names match
163 * in target and source database.
165 PMA_getMatchingTables($trg_tables, $src_tables, $matching_tables, $source_tables_uncommon);
167 * Finding the uncommon tables for the target database
168 * using function PMA_getNonMatchingTargetTables()
170 PMA_getNonMatchingTargetTables($trg_tables, $matching_tables, $target_tables_uncommon);
173 * Initializing several arrays to save the data and structure
174 * difference between the source and target databases.
176 $row_count = array(); //number of rows in source table that needs to be created in target database
177 $fields_num = array(); //number of fields in each matching table
178 $delete_array = array(); //stores the primary key values for target tables that have excessive rows than corresponding source tables.
179 $insert_array = array(array(array()));// stores the primary key values for the rows in each source table that are not present in target tables.
180 $update_array = array(array(array())); //stores the primary key values, name of field to be updated, value of the field to be updated for
181 // each row of matching table.
182 $matching_tables_fields = array(); //contains the fields' names for each matching table
183 $matching_tables_keys = array(); //contains the primary keys' names for each matching table
184 $uncommon_tables_fields = array(); //coantains the fields for all the source tables that are not present in target
185 $matching_tables_num = sizeof($matching_tables);
187 $source_columns = array(); //contains the full columns' information for all the source tables' columns
188 $target_columns = array(); //contains the full columns' information for all the target tables' columns
189 $uncommon_columns = array(); //contains names of columns present in source table but absent from the corresponding target table
190 $source_indexes = array(); //contains indexes on all the source tables
191 $target_indexes = array(); //contains indexes on all the target tables
192 $add_indexes_array = array(); //contains the indexes name present in source but absent from target tables
193 $target_tables_keys = array(); //contains the keys of all the target tables
194 $alter_indexes_array = array(); //contains the names of all the indexes for each table that need to be altered in target database
195 $remove_indexes_array = array(); //contains the names of indexes that are excessive in target tables
196 $alter_str_array = array(array()); //contains the criteria for each column that needs to be altered in target tables
197 $add_column_array = array(array()); //contains the name of columns that need to be added in target tables
199 * The criteria array contains all the criteria against which columns are compared for differences.
201 $criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment');
203 for ($i = 0; $i < sizeof($matching_tables); $i++
) {
205 * Finding out all the differences structure, data and index diff
206 * for all the matching tables only
208 PMA_dataDiffInTables($src_db, $trg_db, $src_link, $trg_link,
209 $matching_tables, $matching_tables_fields, $update_array,
210 $insert_array, $delete_array, $fields_num, $i,
211 $matching_tables_keys);
213 PMA_structureDiffInTables($src_db, $trg_db, $src_link, $trg_link,
214 $matching_tables, $source_columns, $target_columns,
215 $alter_str_array, $add_column_array, $uncommon_columns,
216 $criteria, $target_tables_keys, $i);
218 PMA_indexesDiffInTables($src_db, $trg_db, $src_link, $trg_link,
219 $matching_tables, $source_indexes, $target_indexes,
220 $add_indexes_array, $alter_indexes_array, $remove_indexes_array, $i);
223 for ($j = 0; $j < sizeof($source_tables_uncommon); $j++
) {
225 * Finding out the number of rows to be added in tables
226 * that need to be added in target database
228 PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db,
229 $src_link, $j, $row_count);
233 * Storing all arrays in session for use when page is reloaded
234 * for each button press
236 $_SESSION['matching_tables'] = $matching_tables;
237 $_SESSION['update_array'] = $update_array;
238 $_SESSION['insert_array'] = $insert_array;
239 $_SESSION['src_db'] = $src_db;
240 $_SESSION['trg_db'] = $trg_db;
241 $_SESSION['matching_fields'] = $matching_tables_fields;
242 $_SESSION['src_uncommon_tables'] = $source_tables_uncommon;
243 $_SESSION['src_username'] = $src_username ;
244 $_SESSION['trg_username'] = $trg_username;
245 $_SESSION['src_password'] = $src_password;
246 $_SESSION['trg_password'] = $trg_password;
247 $_SESSION['trg_password'] = $trg_password;
248 $_SESSION['src_server'] = $src_server;
249 $_SESSION['trg_server'] = $trg_server;
250 $_SESSION['src_type'] = $src_type;
251 $_SESSION['trg_type'] = $trg_type;
252 $_SESSION['matching_tables_keys'] = $matching_tables_keys;
253 $_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields;
254 $_SESSION['uncommon_tables_row_count'] = $row_count;
255 $_SESSION['target_tables_uncommon'] = $target_tables_uncommon;
256 $_SESSION['uncommon_tables'] = $source_tables_uncommon;
257 $_SESSION['delete_array'] = $delete_array;
258 $_SESSION['uncommon_columns'] = $uncommon_columns;
259 $_SESSION['source_columns'] = $source_columns;
260 $_SESSION['alter_str_array'] = $alter_str_array;
261 $_SESSION['target_tables_keys'] = $target_tables_keys;
262 $_SESSION['add_column_array'] = $add_column_array;
263 $_SESSION['criteria'] = $criteria;
264 $_SESSION['target_tables'] = $trg_tables;
265 $_SESSION['add_indexes_array'] = $add_indexes_array;
266 $_SESSION['alter_indexes_array'] = $alter_indexes_array;
267 $_SESSION['remove_indexes_array'] = $remove_indexes_array;
268 $_SESSION['source_indexes'] = $source_indexes;
269 $_SESSION['target_indexes'] = $target_indexes;
272 * Displays the sub-heading and icons showing Structure Synchronization
273 * and Data Synchronization
276 <form name
="synchronize_form" id
="synchronize_form" method
="post" action
="server_synchronize.php">
277 <?php
echo PMA_generate_common_hidden_inputs('', ''); ?
>
281 <img
class="icon" src
="<?php echo $pmaThemeImage; ?>new_struct.png" width
="16" height
="16" alt
="" />
282 <?php
echo __('Structure Synchronization'); ?
>
285 <img
class="icon" src
="<?php echo $pmaThemeImage; ?>new_data.png" width
="16" height
="16" alt
="" />
286 <?php
echo __('Data Synchronization'); ?
>
292 * Displays the tables containing the source tables names,
293 * their difference with the target tables and target tables names.
295 PMA_syncDisplayHeaderCompare($src_db, $trg_db);
299 * Display the matching tables' names and difference, first
301 for ($i = 0; $i < count($matching_tables); $i++
) {
303 * Calculating the number of updates for each matching table
305 if (isset($update_array[$i]) && isset($update_array[$i][0])
306 && !empty($matching_tables_keys[$i][0])
307 && isset($update_array[$i][0][$matching_tables_keys[$i][0]])) {
308 $num_of_updates = sizeof($update_array[$i]);
313 * Calculating the number of insertions for each matching table
315 if (isset($insert_array[$i]) && isset($insert_array[$i][0])
316 && !empty($matching_tables_keys[$i])
317 && isset($insert_array[$i][0][$matching_tables_keys[$i][0]])) {
318 $num_of_insertions = sizeof($insert_array[$i]);
320 $num_of_insertions = 0;
324 * Calculating the number of alter columns, number of columns to be
325 * added, number of columns to be removed,
326 * number of index to be added and removed.
329 $num_insert_cols = 0;
330 $num_remove_cols = 0;
332 $num_remove_index = 0;
334 if (isset($alter_str_array[$i])) {
335 $num_alter_cols = sizeof($alter_str_array[$i]);
337 if (isset($add_column_array[$i])) {
338 $num_insert_cols = sizeof($add_column_array[$i]);
340 if (isset($uncommon_columns[$i])) {
341 $num_remove_cols = sizeof($uncommon_columns[$i]);
343 if (isset($add_indexes_array[$i])) {
344 $num_add_index = sizeof($add_indexes_array[$i]);
346 if (isset($remove_indexes_array[$i])) {
347 $num_remove_index = sizeof($remove_indexes_array[$i]);
349 if (isset($alter_indexes_array[$i])) {
350 $num_add_index +
= sizeof($alter_indexes_array[$i]);
351 $num_remove_index +
= sizeof($alter_indexes_array[$i]);
354 $btn_structure_params = null;
355 $btn_data_params = null;
358 * Display the red button of structure synchronization if there
359 * exists any structure difference or index difference.
361 if (($num_alter_cols > 0)
362 ||
($num_insert_cols > 0)
363 ||
($num_remove_cols > 0)
364 ||
($num_add_index > 0)
365 ||
($num_remove_index > 0)
367 $btn_structure_params = array($i, $num_alter_cols, $num_insert_cols,
368 $num_remove_cols, $num_add_index, $num_remove_index);
372 * Display the green button of data synchronization if there exists
373 * any data difference.
375 if ((isset($update_array[$i])
376 ||
isset($insert_array[$i]))
377 && !empty($matching_tables_keys[$i])
379 if (isset($update_array[$i][0][$matching_tables_keys[$i][0]])
380 ||
isset($insert_array[$i][0][$matching_tables_keys[$i][0]])
382 $btn_data_params = array($i, $num_of_updates,
383 $num_of_insertions, null, null, null);
388 'src_table_name' => $matching_tables[$i],
389 'dst_table_name' => $matching_tables[$i],
391 'btn_structure' => $btn_structure_params,
392 'btn_data' => $btn_data_params
396 * Displays the tables' names present in source but missing from target
398 for ($j = 0; $j < count($source_tables_uncommon); $j++
) {
400 'src_table_name' => '+ ' . $source_tables_uncommon[$j],
401 'dst_table_name' => $source_tables_uncommon[$j] . ' (' . __('not present') . ')',
403 'btn_structure' => array($j, null, null, null, null, null),
406 if ($row_count[$j] > 0) {
407 $row['btn_data'] = array($j, null, $row_count[$j], null, null, null);
411 foreach ($target_tables_uncommon as $tbl_nc_name) {
413 'src_table_name' => '',
414 'dst_table_name' => $tbl_nc_name);
417 * Displays the target tables names
419 PMA_syncDisplayDataCompare($rows);
425 * This "list" div will contain a table and each row will depict
426 * information about structure/data difference in tables.
427 * Rows will be generated dynamically as soon as the colored
428 * buttons "D" or "S" are clicked.
431 echo '<fieldset style="padding:0"><div id="list" style="overflow:auto; height:140px; padding:1em">
435 <tr style="width: 100%;">
436 <th id="table_name" style="width: 10%;" colspan="1">' . __('Table') . ' </th>
437 <th id="str_diff" style="width: 65%;" colspan="6">' . __('Structure Difference') . ' </th>
438 <th id="data_diff" style="width: 20%;" colspan="2">' . __('Data Difference') . '</th>
440 <tr style="width: 100%;">
441 <th style="width: 10%;">' . __('Table name') . '</th>
442 <th style="width: 10%;">' . __('Create table'). '</th>
443 <th style="width: 11%;">' . __('Add column(s)') . '</th>
444 <th style="width: 13%;">' . __('Remove column(s)') . '</th>
445 <th style="width: 11%;">' . __('Alter column(s)') . '</th>
446 <th style="width: 12%;">' . __('Remove index(s)') . '</th>
447 <th style="width: 11%;">' . __('Apply index(s)') . '</th>
448 <th style="width: 10%;">'. __('Update row(s)') . '</th>
449 <th style="width: 10%;">' . __('Insert row(s)') . '</th>
456 * This fieldset displays the checkbox to confirm deletion of previous rows from target tables
459 <p><input type= "checkbox" name="delete_rows" id ="delete_rows" /><label for="delete_rows">'
460 . __('Would you like to delete all the previous rows from target tables?')
463 <fieldset class="tblFooters">';
464 echo '<input type="button" name="apply_changes" value="'
465 . __('Apply Selected Changes')
466 . '" onclick ="ApplySelectedChanges('
467 . "'" . htmlspecialchars($_SESSION['token']) . "'" . ')" />';
468 echo '<input type="submit" name="synchronize_db" value="'
469 . __('Synchronize Databases') . '" />' . '</fieldset>';
473 } // end if ((isset($_REQUEST['submit_connect'])))
476 * Display the page when 'Apply Selected Changes' is pressed
478 if (isset($_REQUEST['Table_ids'])) {
480 * Displays success message
482 echo '<div class="success">'
483 . __('Selected target tables have been synchronized with source tables.')
486 $src_db = $_SESSION['src_db'];
487 $trg_db = $_SESSION['trg_db'];
488 $update_array = $_SESSION['update_array'];
489 $insert_array = $_SESSION['insert_array'];
490 $src_username = $_SESSION['src_username'];
491 $trg_username = $_SESSION['trg_username'];
492 $src_password = $_SESSION['src_password'];
493 $trg_password = $_SESSION['trg_password'];
494 $src_server = $_SESSION['src_server'];
495 $trg_server = $_SESSION['trg_server'];
496 $src_type = $_SESSION['src_type'];
497 $trg_type = $_SESSION['trg_type'];
498 $uncommon_tables = $_SESSION['uncommon_tables'];
499 $matching_tables = $_SESSION['matching_tables'];
500 $matching_tables_keys = $_SESSION['matching_tables_keys'];
501 $matching_tables_fields = $_SESSION['matching_fields'];
502 $source_tables_uncommon = $_SESSION['src_uncommon_tables'];
503 $uncommon_tables_fields = $_SESSION['uncommon_tables_fields'];
504 $target_tables_uncommon = $_SESSION['target_tables_uncommon'];
505 $row_count = $_SESSION['uncommon_tables_row_count'];
506 $target_tables = $_SESSION['target_tables'];
508 $delete_array = $_SESSION['delete_array'];
509 $uncommon_columns = $_SESSION['uncommon_columns'];
510 $source_columns = $_SESSION['source_columns'];
511 $alter_str_array = $_SESSION['alter_str_array'];
512 $criteria = $_SESSION['criteria'];
513 $target_tables_keys = $_SESSION['target_tables_keys'];
514 $add_column_array = $_SESSION['add_column_array'];
515 $add_indexes_array = $_SESSION['add_indexes_array'];
516 $alter_indexes_array = $_SESSION['alter_indexes_array'];
517 $remove_indexes_array = $_SESSION['remove_indexes_array'];
518 $source_indexes = $_SESSION['source_indexes'];
519 $target_indexes = $_SESSION['target_indexes'];
520 $uncommon_cols = $uncommon_columns;
523 * Creating link object for source and target databases
525 foreach ($cons as $con) {
526 if ($
{"{$con}_type"} != "cur") {
527 $
{"{$con}_link"} = PMA_DBI_connect($
{"{$con}_username"},
528 $
{"{$con}_password"}, $is_controluser = false, $
{"{$con}_server"});
530 $
{"{$con}_link"} = null;
531 // working on current server, so initialize this for tracking
532 // (does not work if user defined current server as a remote one)
533 $GLOBALS['db'] = $
{"{$con}_db"};
535 } // end foreach ($cons as $con)
538 * Initializing arrays to save the table ids whose data and structure difference is to be applied
540 $matching_table_data_diff = array(); //stores id of matching table having data difference
541 $matching_table_structure_diff = array(); //stores id of matching tables having structure difference
542 $uncommon_table_structure_diff = array(); //stores id of uncommon tables having structure difference
543 $uncommon_table_data_diff = array(); //stores id of uncommon tables having data difference
545 for ($i = 0; isset($_REQUEST[$i]); $i++
) {
546 if (isset($_REQUEST[$i])) {
547 $table_id = explode("US", $_REQUEST[$i]);
548 if (isset($table_id[1])) {
549 $uncommon_table_structure_diff[] = $table_id[1];
551 $table_id = explode("UD", $_REQUEST[$i]);
552 if (isset($table_id[1])) {
553 $uncommon_table_data_diff[] = $table_id[1];
555 $table_id = explode("MS", $_REQUEST[$i]);
556 if (isset($table_id[1])) {
557 $matching_table_structure_diff[] = $table_id[1];
560 $table_id = explode("MD", $_REQUEST[$i]);
561 if (isset($table_id[1])) {
562 $matching_table_data_diff[] = $table_id[1];
567 * Applying the structure difference on selected matching tables
569 for ($q = 0; $q < sizeof($matching_table_structure_diff); $q++
) {
570 if (isset($alter_str_array[$matching_table_structure_diff[$q]])) {
571 PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
572 $source_columns, $alter_str_array, $matching_tables_fields,
573 $criteria, $matching_tables_keys, $target_tables_keys,
574 $matching_table_structure_diff[$q], false);
576 unset($alter_str_array[$matching_table_structure_diff[$q]]);
578 if (isset($add_column_array[$matching_table_structure_diff[$q]])) {
579 PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables,
580 $matching_table_structure_diff[$q], $target_tables_keys,
581 $matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link);
583 if (isset($delete_array[$matching_table_structure_diff[$q]])) {
584 PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
585 $matching_table_structure_diff[$q], $target_tables_keys,
586 $delete_array, false);
588 unset($delete_array[$matching_table_structure_diff[$q]]);
590 PMA_addColumnsInTargetTable($src_db, $trg_db,$src_link, $trg_link,
591 $matching_tables, $source_columns, $add_column_array,
592 $matching_tables_fields, $criteria, $matching_tables_keys,
593 $target_tables_keys, $uncommon_tables,$uncommon_tables_fields,
594 $matching_table_structure_diff[$q], $uncommon_cols, false);
596 unset($add_column_array[$matching_table_structure_diff[$q]]);
598 if (isset($uncommon_columns[$matching_table_structure_diff[$q]])) {
599 PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
600 $uncommon_columns, $matching_table_structure_diff[$q], false);
602 unset($uncommon_columns[$matching_table_structure_diff[$q]]);
604 if (isset($add_indexes_array[$matching_table_structure_diff[$q]])
605 ||
isset($remove_indexes_array[$matching_table_structure_diff[$q]])
606 ||
isset($alter_indexes_array[$matching_table_structure_diff[$q]])
608 PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables,
609 $source_indexes, $target_indexes, $add_indexes_array,
610 $alter_indexes_array, $remove_indexes_array,
611 $matching_table_structure_diff[$q], false);
613 unset($add_indexes_array[$matching_table_structure_diff[$q]]);
614 unset($alter_indexes_array[$matching_table_structure_diff[$q]]);
615 unset($remove_indexes_array[$matching_table_structure_diff[$q]]);
619 * Applying the data difference. First checks if structure diff is applied or not.
620 * If not, then apply structure difference first then apply data difference.
622 for ($p = 0; $p < sizeof($matching_table_data_diff); $p++
) {
623 if ($_REQUEST['checked'] == 'true') {
624 PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables,
625 $matching_table_data_diff[$p], $target_tables_keys,
626 $matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link);
628 if (isset($delete_array[$matching_table_data_diff[$p]])) {
629 PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
630 $matching_table_data_diff[$p], $target_tables_keys,
631 $delete_array, false);
633 unset($delete_array[$matching_table_data_diff[$p]]);
636 if (isset($alter_str_array[$matching_table_data_diff[$p]])) {
637 PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
638 $source_columns, $alter_str_array, $matching_tables_fields,
639 $criteria, $matching_tables_keys, $target_tables_keys,
640 $matching_table_data_diff[$p], false);
642 unset($alter_str_array[$matching_table_data_diff[$p]]);
644 if (isset($add_column_array[$matching_table_data_diff[$p]])) {
645 PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables,
646 $matching_table_data_diff[$p], $target_tables_keys,
647 $matching_tables_keys, $trg_db, $trg_link, $src_db, $src_link);
649 if (isset($delete_array[$matching_table_data_diff[$p]])) {
650 PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables,
651 $matching_table_data_diff[$p], $target_tables_keys,
652 $delete_array, false);
654 unset($delete_array[$matching_table_data_diff[$p]]);
656 PMA_addColumnsInTargetTable($src_db, $trg_db,$src_link, $trg_link,
657 $matching_tables, $source_columns, $add_column_array,
658 $matching_tables_fields, $criteria, $matching_tables_keys,
659 $target_tables_keys, $uncommon_tables, $uncommon_tables_fields,
660 $matching_table_data_diff[$p], $uncommon_cols, false);
662 unset($add_column_array[$matching_table_data_diff[$p]]);
664 if (isset($uncommon_columns[$matching_table_data_diff[$p]])) {
665 PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
666 $uncommon_columns, $matching_table_data_diff[$p], false);
668 unset($uncommon_columns[$matching_table_data_diff[$p]]);
670 if ((isset($matching_table_structure_diff[$q])
671 && isset($add_indexes_array[$matching_table_structure_diff[$q]]))
672 ||
(isset($matching_table_structure_diff[$q])
673 && isset($remove_indexes_array[$matching_table_structure_diff[$q]]))
674 ||
(isset($matching_table_structure_diff[$q])
675 && isset($alter_indexes_array[$matching_table_structure_diff[$q]]))
677 PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables,
678 $source_indexes, $target_indexes, $add_indexes_array,
679 $alter_indexes_array, $remove_indexes_array,
680 $matching_table_structure_diff[$q], false);
682 unset($add_indexes_array[$matching_table_structure_diff[$q]]);
683 unset($alter_indexes_array[$matching_table_structure_diff[$q]]);
684 unset($remove_indexes_array[$matching_table_structure_diff[$q]]);
687 * Applying the data difference.
689 PMA_updateTargetTables($matching_tables, $update_array, $src_db, $trg_db,
690 $trg_link, $matching_table_data_diff[$p], $matching_tables_keys, false);
692 PMA_insertIntoTargetTable($matching_tables, $src_db, $trg_db, $src_link,
693 $trg_link, $matching_tables_fields, $insert_array,
694 $matching_table_data_diff[$p], $matching_tables_keys, $source_columns,
695 $add_column_array, $criteria, $target_tables_keys, $uncommon_tables,
696 $uncommon_tables_fields, $uncommon_cols, $alter_str_array,
697 $source_indexes, $target_indexes, $add_indexes_array,
698 $alter_indexes_array, $delete_array, $update_array, false);
701 * Updating the session variables to the latest values of the arrays.
703 $_SESSION['delete_array'] = $delete_array;
704 $_SESSION['uncommon_columns'] = $uncommon_columns;
705 $_SESSION['alter_str_array'] = $alter_str_array;
706 $_SESSION['add_column_array'] = $add_column_array;
707 $_SESSION['add_indexes_array'] = $add_indexes_array;
708 $_SESSION['remove_indexes_array'] = $remove_indexes_array;
709 $_SESSION['insert_array'] = $insert_array;
710 $_SESSION['update_array'] = $update_array;
713 * Applying structure difference to selected non-matching tables
714 * (present in Source but absent from Target).
716 for ($s = 0; $s < sizeof($uncommon_table_structure_diff); $s++
) {
717 PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
718 $uncommon_tables, $uncommon_table_structure_diff[$s],
719 $uncommon_tables_fields, false);
720 $_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields;
722 unset($uncommon_tables[$uncommon_table_structure_diff[$s]]);
725 * Applying data difference to selected non-matching tables
726 * (present in Source but absent from Target).
727 * Before data synchronization, structure synchronization is confirmed.
729 for ($r = 0; $r < sizeof($uncommon_table_data_diff); $r++
) {
730 if (!(in_array($uncommon_table_data_diff[$r], $uncommon_table_structure_diff))) {
731 if (isset($uncommon_tables[$uncommon_table_data_diff[$r]])) {
732 PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
733 $uncommon_tables, $uncommon_table_data_diff[$r],
734 $uncommon_tables_fields, false);
735 $_SESSION['uncommon_tables_fields'] = $uncommon_tables_fields;
737 unset($uncommon_tables[$uncommon_table_data_diff[$r]]);
740 PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link,
741 $source_tables_uncommon, $uncommon_table_data_diff[$r],
742 $_SESSION['uncommon_tables_fields'], false);
744 unset($row_count[$uncommon_table_data_diff[$r]]);
747 * Again all the tables from source and target database are displayed with their differences.
748 * The differences have been removed from tables that have been synchronized
750 echo '<form name="applied_difference" id="synchronize_form" method="post" action="server_synchronize.php">'
751 . PMA_generate_common_hidden_inputs('', '');
753 PMA_syncDisplayHeaderCompare($src_db, $trg_db);
755 for ($i = 0; $i < count($matching_tables); $i++
) {
757 $num_insert_cols = 0;
758 $num_remove_cols = 0;
760 $num_remove_index = 0;
762 if (isset($alter_str_array[$i])) {
763 $num_alter_cols = sizeof($alter_str_array[$i]);
765 if (isset($add_column_array[$i])) {
766 $num_insert_cols = sizeof($add_column_array[$i]);
768 if (isset($uncommon_columns[$i])) {
769 $num_remove_cols = sizeof($uncommon_columns[$i]);
771 if (isset($add_indexes_array[$i])) {
772 $num_add_index = sizeof($add_indexes_array[$i]);
774 if (isset($remove_indexes_array[$i])) {
775 $num_remove_index = sizeof($remove_indexes_array[$i]);
778 $btn_structure_params = null;
779 $btn_data_params = null;
781 if (($num_alter_cols > 0)
782 ||
($num_insert_cols > 0)
783 ||
($num_remove_cols > 0)
784 ||
($num_add_index > 0)
785 ||
($num_remove_index > 0)
787 $btn_structure_params = array($i, $num_alter_cols, $num_insert_cols,
788 $num_remove_cols, $num_add_index, $num_remove_index);
790 if (!(in_array($i, $matching_table_data_diff))) {
791 if (isset($matching_tables_keys[$i][0])
792 && isset($update_array[$i][0][$matching_tables_keys[$i][0]])
794 if (isset($update_array[$i])) {
795 $num_of_updates = sizeof($update_array[$i]);
802 if (isset($matching_tables_keys[$i][0])
803 && isset($insert_array[$i][0][$matching_tables_keys[$i][0]])
805 if (isset($insert_array[$i])) {
806 $num_of_insertions = sizeof($insert_array[$i]);
808 $num_of_insertions = 0;
811 $num_of_insertions = 0;
814 if ((isset($matching_tables_keys[$i][0])
815 && isset($update_array[$i][0][$matching_tables_keys[$i][0]]))
816 ||
(isset($matching_tables_keys[$i][0])
817 && isset($insert_array[$i][0][$matching_tables_keys[$i][0]]))
819 $btn_data_params = array($i, $num_of_updates, $num_of_insertions,
823 unset($update_array[$i]);
824 unset($insert_array[$i]);
827 'src_table_name' => $matching_tables[$i],
828 'dst_table_name' => $matching_tables[$i],
830 'btn_structure' => $btn_structure_params,
831 'btn_data' => $btn_data_params
835 * placing updated value of arrays in session
838 $_SESSION['update_array'] = $update_array;
839 $_SESSION['insert_array'] = $insert_array;
841 for ($j = 0; $j < count($source_tables_uncommon); $j++
) {
842 $btn_structure_params = null;
843 $btn_data_params = null;
846 * Display the difference only when it has not been applied
848 if (!(in_array($j, $uncommon_table_structure_diff))) {
849 if (isset($uncommon_tables[$j])) {
850 $btn_structure_params = array($j, null, null, null, null, null);
852 $dst_table_name = $source_tables_uncommon[$j] . ' (' . __('not present') . ')';
854 unset($uncommon_tables[$j]);
855 $dst_table_name = $source_tables_uncommon[$j];
858 * Display the difference only when it has not been applied
860 if (!(in_array($j, $uncommon_table_data_diff))) {
861 if (isset($row_count[$j]) && ($row_count[$j] > 0)) {
862 $btn_data_params = array($j, null, $row_count[$j], null, null, null);
865 unset($row_count[$j]);
869 'src_table_name' => $source_tables_uncommon[$j],
870 'dst_table_name' => $dst_table_name,
872 'btn_structure' => $btn_structure_params,
873 'btn_data' => $btn_data_params
877 * placing the latest values of arrays in session
880 $_SESSION['uncommon_tables'] = $uncommon_tables;
881 $_SESSION['uncommon_tables_row_count'] = $row_count;
885 * Displaying the target database tables
887 foreach ($target_tables_uncommon as $tbl_nc_name) {
889 'src_table_name' => '',
890 'dst_table_name' => $tbl_nc_name);
892 PMA_syncDisplayDataCompare($rows);
898 * This "list" div will contain a table and each row will depict information about
899 * structure/data difference in tables.
900 * Rows will be generated dynamically as soon as the colored buttons "D" or "S"
904 echo '<fieldset style="padding:0"><div id="list" style = "overflow:auto; height:140px; padding:1em">';
907 <tr style="width: 100%;">
908 <th id="table_name" style="width: 10%;" colspan="1">' . __('Table') . ' </th>
909 <th id="str_diff" style="width: 65%;" colspan="6">' . __('Structure Difference') . ' </th>
910 <th id="data_diff" style="width: 20%;" colspan="2">' . __('Data Difference') . '</th>
912 <tr style="width: 100%;">
913 <th style="width: 10%;">' . __('Table name') . '</th>
914 <th style="width: 10%;">' . __('Create table'). '</th>
915 <th style="width: 11%;">' . __('Add column(s)') . '</th>
916 <th style="width: 13%;">' . __('Remove column(s)') . '</th>
917 <th style="width: 11%;">' . __('Alter column(s)') . '</th>
918 <th style="width: 12%;">' . __('Remove index(s)') . '</th>
919 <th style="width: 11%;">' . __('Apply index(s)') . '</th>
920 <th style="width: 10%;">' . __('Update row(s)') . '</th>
921 <th style="width: 10%;">' . __('Insert row(s)') . '</th>
929 * This fieldset displays the checkbox to confirm deletion of previous rows from target tables
932 <p><input type="checkbox" name="delete_rows" id ="delete_rows" /><label for="delete_rows">'
933 . __('Would you like to delete all the previous rows from target tables?') . '</label> </p>
936 echo '<fieldset class="tblFooters">';
937 echo '<input type="button" name="apply_changes" value="'
938 . __('Apply Selected Changes') . '" onclick ="ApplySelectedChanges('
939 . "'" . htmlspecialchars($_SESSION['token']) . "'" .')" />';
940 echo '<input type="submit" name="synchronize_db" value="'
941 . __('Synchronize Databases') . '" />'
947 * Displays the page when 'Synchronize Databases' is pressed.
950 if (isset($_REQUEST['synchronize_db'])) {
952 $src_db = $_SESSION['src_db'];
953 $trg_db = $_SESSION['trg_db'];
954 $update_array = $_SESSION['update_array'];
955 $insert_array = $_SESSION['insert_array'];
956 $src_username = $_SESSION['src_username'];
957 $trg_username = $_SESSION['trg_username'];
958 $src_password = $_SESSION['src_password'];
959 $trg_password = $_SESSION['trg_password'];
960 $matching_tables = $_SESSION['matching_tables'];
961 $matching_tables_keys = $_SESSION['matching_tables_keys'];
962 $matching_tables_fields = $_SESSION['matching_fields'];
963 $source_tables_uncommon = $_SESSION['src_uncommon_tables'];
964 $uncommon_tables_fields = $_SESSION['uncommon_tables_fields'];
965 $target_tables_uncommon = $_SESSION['target_tables_uncommon'];
966 $row_count = $_SESSION['uncommon_tables_row_count'];
967 $uncommon_tables = $_SESSION['uncommon_tables'];
968 $target_tables = $_SESSION['target_tables'];
970 $delete_array = $_SESSION['delete_array'];
971 $uncommon_columns = $_SESSION['uncommon_columns'];
972 $source_columns = $_SESSION['source_columns'];
973 $alter_str_array = $_SESSION['alter_str_array'];
974 $criteria = $_SESSION['criteria'];
975 $target_tables_keys = $_SESSION['target_tables_keys'];
976 $add_column_array = $_SESSION['add_column_array'];
977 $add_indexes_array = $_SESSION['add_indexes_array'];
978 $alter_indexes_array = $_SESSION['alter_indexes_array'];
979 $remove_indexes_array = $_SESSION['remove_indexes_array'];
980 $source_indexes = $_SESSION['source_indexes'];
981 $target_indexes = $_SESSION['target_indexes'];
982 $uncommon_cols = $uncommon_columns;
985 * Display success message.
987 echo '<div class="success">'
988 . __('Target database has been synchronized with source database')
991 * Displaying all the tables of source and target database
992 * and now no difference is there.
994 PMA_syncDisplayHeaderCompare($src_db, $trg_db);
996 for ($i = 0; $i < count($matching_tables); $i++
) {
998 'src_table_name' => $matching_tables[$i],
999 'dst_table_name' => $matching_tables[$i]);
1001 foreach ($source_tables_uncommon as $tbl_nc_name) {
1003 'src_table_name' => '+ ' . $tbl_nc_name,
1004 'dst_table_name' => $tbl_nc_name);
1006 foreach ($target_tables_uncommon as $tbl_nc_name) {
1008 'src_table_name' => '',
1009 'dst_table_name' => $tbl_nc_name);
1011 PMA_syncDisplayDataCompare($rows);
1017 * connecting the source and target servers
1019 if ('cur' != $_SESSION['src_type']) {
1020 $src_link = PMA_DBI_connect($src_username, $src_password, $is_controluser = false, $_SESSION['src_server']);
1021 $src_version = PMA_DBI_fetch_value('SELECT VERSION()', 0, 0, $src_link);
1022 $src_is_drizzle = (bool)preg_match('/\d{4}\./', $src_version);
1024 $src_link = $GLOBALS['userlink'];
1025 $src_version = PMA_MYSQL_STR_VERSION
;
1026 $src_is_drizzle = PMA_DRIZZLE
;
1027 // working on current server, so initialize this for tracking
1028 // (does not work if user defined current server as a remote one)
1029 $GLOBALS['db'] = $_SESSION['src_db'];
1031 if ('cur' != $_SESSION['trg_type']) {
1032 $trg_link = PMA_DBI_connect($trg_username, $trg_password, $is_controluser = false, $_SESSION['trg_server']);
1033 $trg_version = PMA_DBI_fetch_value('SELECT VERSION()', 0, 0, $trg_link);
1034 $trg_is_drizzle = (bool)preg_match('/\d{4}\./', $trg_version);
1036 $trg_link = $GLOBALS['userlink'];
1037 $trg_version = PMA_MYSQL_STR_VERSION
;
1038 $trg_is_drizzle = PMA_DRIZZLE
;
1039 // working on current server, so initialize this for tracking
1040 $GLOBALS['db'] = $_SESSION['trg_db'];
1044 * Displaying the queries.
1046 echo '<fieldset><legend>' . __('Executed queries') . '</legend>';
1048 * Applying all sorts of differences for each matching table
1050 for ($p = 0; $p < sizeof($matching_tables); $p++
) {
1052 * If the check box is checked for deleting previous rows from the target database tables then
1053 * first find out rows to be deleted and then delete the rows.
1055 if (isset($_REQUEST['delete_rows'])) {
1056 PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables, $p,
1057 $target_tables_keys, $matching_tables_keys,
1058 $trg_db, $trg_link, $src_db, $src_link);
1060 if (isset($delete_array[$p])) {
1061 PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $p,
1062 $target_tables_keys, $delete_array, true);
1063 unset($delete_array[$p]);
1066 if (isset($alter_str_array[$p])) {
1067 PMA_alterTargetTableStructure($trg_db, $trg_link, $matching_tables,
1068 $source_columns, $alter_str_array, $matching_tables_fields,
1069 $criteria, $matching_tables_keys, $target_tables_keys, $p, true);
1070 unset($alter_str_array[$p]);
1072 if (! empty($add_column_array[$p])) {
1073 PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables, $p,
1074 $target_tables_keys, $matching_tables_keys,
1075 $trg_db, $trg_link, $src_db, $src_link);
1077 if (isset($delete_array[$p])) {
1078 PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $p,
1079 $target_tables_keys, $delete_array, true);
1080 unset($delete_array[$p]);
1082 PMA_addColumnsInTargetTable($src_db, $trg_db, $src_link, $trg_link,
1083 $matching_tables, $source_columns, $add_column_array,
1084 $matching_tables_fields, $criteria, $matching_tables_keys,
1085 $target_tables_keys, $uncommon_tables, $uncommon_tables_fields,
1086 $p, $uncommon_cols, true);
1087 unset($add_column_array[$p]);
1089 if (isset($uncommon_columns[$p])) {
1090 PMA_removeColumnsFromTargetTable($trg_db, $trg_link, $matching_tables,
1091 $uncommon_columns, $p, true);
1092 unset($uncommon_columns[$p]);
1094 if (isset($matching_table_structure_diff)
1095 && (isset($add_indexes_array[$matching_table_structure_diff[$p]])
1096 ||
isset($remove_indexes_array[$matching_table_structure_diff[$p]])
1097 ||
isset($alter_indexes_array[$matching_table_structure_diff[$p]]))
1099 PMA_applyIndexesDiff ($trg_db, $trg_link, $matching_tables,
1100 $source_indexes, $target_indexes, $add_indexes_array,
1101 $alter_indexes_array, $remove_indexes_array,
1102 $matching_table_structure_diff[$p], true);
1104 unset($add_indexes_array[$matching_table_structure_diff[$p]]);
1105 unset($alter_indexes_array[$matching_table_structure_diff[$p]]);
1106 unset($remove_indexes_array[$matching_table_structure_diff[$p]]);
1109 PMA_updateTargetTables($matching_tables, $update_array, $src_db, $trg_db,
1110 $trg_link, $p, $matching_tables_keys, true);
1112 PMA_insertIntoTargetTable($matching_tables, $src_db, $trg_db, $src_link,
1113 $trg_link , $matching_tables_fields, $insert_array, $p,
1114 $matching_tables_keys, $matching_tables_keys, $source_columns,
1115 $add_column_array, $criteria, $target_tables_keys, $uncommon_tables,
1116 $uncommon_tables_fields,$uncommon_cols, $alter_str_array,$source_indexes,
1117 $target_indexes, $add_indexes_array,
1118 $alter_indexes_array, $delete_array, $update_array, true);
1122 * Creating and populating tables present in source but absent
1123 * from target database.
1125 for ($q = 0; $q < sizeof($source_tables_uncommon); $q++
) {
1126 if (isset($uncommon_tables[$q])) {
1127 PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link,
1128 $source_tables_uncommon, $q, $uncommon_tables_fields, true);
1130 if (isset($row_count[$q])) {
1131 PMA_populateTargetTables($src_db, $trg_db, $src_link, $trg_link,
1132 $source_tables_uncommon, $q, $uncommon_tables_fields, true);
1139 * Displays the main page when none of the following buttons is pressed
1142 if (! isset($_REQUEST['submit_connect'])
1143 && ! isset($_REQUEST['synchronize_db'])
1144 && ! isset($_REQUEST['Table_ids'])
1147 * Displays the sub-page heading
1149 echo '<h2>' . ($GLOBALS['cfg']['MainPageIconic']
1150 ?
'<img class="icon ic_s_sync" src="themes/dot.gif" alt="" />'
1155 echo '<div id="serverstatus">
1156 <form name="connection_form" id="connection_form" method="post" action="server_synchronize.php"
1157 >' // TODO: add check if all var. are filled in
1158 . PMA_generate_common_hidden_inputs('', '');
1160 echo '<legend>' . __('Synchronize') . '</legend>';
1162 * Displays the forms
1165 $databases = PMA_DBI_get_databases_full(null, false, null, 'SCHEMA_NAME',
1168 if ($GLOBALS['cfg']['AllowArbitraryServer'] === false) {
1169 $possibly_readonly = ' readonly="readonly"';
1171 $possibly_readonly = '';
1174 foreach ($cons as $type) {
1175 if ('src' == $type) {
1176 $database_header = __('Source database');
1178 $database_header = __('Target database');
1181 $database_header .= PMA_showHint(PMA_sanitize(sprintf('%sAllowArbitraryServer%s',
1182 '[a@./Documentation.html#AllowArbitraryServer@_blank]', '[/a]')));
1184 <table id
="serverconnection_<?php echo $type; ?>_remote" class="data noclick">
1185 <caption
class="tblHeaders"><?php
echo $database_header; ?
></caption
>
1187 <td colspan
="2" style
="text-align: center">
1188 <select name
="<?php echo $type; ?>_type" id
="<?php echo $type; ?>_type" class="server_selector">
1190 if ($GLOBALS['cfg']['AllowArbitraryServer']) {
1191 $preselected_option = 'rmt';
1192 echo '<option value="rmt" selected="selected">' . __('Enter manually') . '</option>';
1194 $preselected_option = 'cur';
1196 echo '<option value="cur"';
1197 if ('cur' == $preselected_option) {
1198 echo ' selected="selected"';
1200 echo '>' . __('Current connection') . '</option>';
1202 $loaded_dbi = $GLOBALS['cfg']['Server']['extension'];
1203 foreach ($GLOBALS['cfg']['Servers'] as $key => $tmp_server) {
1204 if (empty($tmp_server['host']) && empty($tmp_server['socket'])) {
1208 if (!empty($tmp_server['verbose'])) {
1209 $label = $tmp_server['verbose'];
1211 $label = $tmp_server['host'];
1212 if (!empty($tmp_server['port'])) {
1213 $label .= ':' . $tmp_server['port'];
1217 if ($loaded_dbi == 'drizzle' && $tmp_server['extension'] != 'drizzle'
1218 ||
$loaded_dbi != 'drizzle' && $tmp_server['extension'] == 'drizzle') {
1219 // incompatible connection protocols
1220 $disabled = ' disabled="disabled"';
1224 $value = $tmp_server['host'];
1226 if (empty($tmp_server['port']) && empty($tmp_server['socket'])) {
1229 $value .= $tmp_server['port'];
1232 $value .= $tmp_server['socket'];
1234 $value .= $tmp_server['user'];
1236 $value .= $tmp_server['only_db'];
1239 echo '<option value="' . $value . '"' . $disabled . '>'
1240 . sprintf(__('Configuration: %s'), htmlspecialchars($label)) . '</option>';
1246 <tr
class="even toggler remote-server">
1247 <td
><?php
echo __('Server'); ?
></td
>
1248 <td
><input type
="text" name
="<?php echo $type; ?>_host" class="server-host" <?php
echo $possibly_readonly; ?
>/></td
>
1250 <tr
class="odd toggler remote-server">
1251 <td
><?php
echo __('Port'); ?
></td
>
1252 <td
><input type
="text" name
="<?php echo $type; ?>_port" class="server-port" <?php
echo $possibly_readonly; ?
> value
="3306" maxlength
="5" size
="5" /></td
>
1254 <tr
class="even toggler remote-server">
1255 <td
><?php
echo __('Socket'); ?
></td
>
1256 <td
><input type
="text" name
="<?php echo $type; ?>_socket" class="server-socket" <?php
echo $possibly_readonly; ?
>/></td
>
1258 <tr
class="odd toggler remote-server">
1259 <td
><?php
echo __('User name'); ?
></td
>
1260 <td
><input type
="text" name
="<?php echo $type; ?>_username" class="server-user" /></td
>
1262 <tr
class="even toggler remote-server">
1263 <td
><?php
echo __('Password'); ?
></td
>
1264 <td
><input type
="password" name
="<?php echo $type; ?>_pass" class="server-pass" /> </td
>
1266 <tr
class="odd toggler remote-server">
1267 <td
><?php
echo __('Database'); ?
></td
>
1268 <td
><input type
="text" name
="<?php echo $type; ?>_db" class="server-db" /></td
>
1270 <tr
class="even toggler current-server" style
="display: none;">
1271 <td
><?php
echo __('Database'); ?
></td
>
1274 // these unset() do not complain if the elements do not exist
1275 unset($databases['mysql']);
1276 unset($databases['information_schema']);
1278 unset($databases['data_dictionary']);
1281 if (count($databases) == 0) {
1282 echo __('No databases');
1285 <select name="' . $type . '_db_sel">
1287 foreach ($databases as $db) {
1288 echo ' <option>' . htmlspecialchars($db['SCHEMA_NAME']) . '</option>';
1295 unset ($types, $type);
1299 <fieldset class="tblFooters">
1300 <input type="submit" name="submit_connect" value="' . __('Go') .'" id="buttonGo" />
1304 <div class="notice">' . __('Target database will be completely synchronized with source database. Source database will remain unchanged.') . '</div>';
1308 * Displays the footer
1310 require './libraries/footer.inc.php';