indenting, coding style, typos

This commit is contained in:
Marc Delisle
2009-10-03 13:15:46 +00:00
parent 05282dea25
commit a7497999d7

View File

@@ -75,7 +75,7 @@ if ((isset($_REQUEST['submit_connect']))) {
} }
${"{$con}_connection"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); ${"{$con}_connection"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"});
} } // end foreach ($cons as $con)
if ((! $src_connection && $src_type=='rmt') || (! $trg_connection && $trg_type=='rmt')) { if ((! $src_connection && $src_type=='rmt') || (! $trg_connection && $trg_type=='rmt')) {
/** /**
@@ -99,12 +99,13 @@ if ((isset($_REQUEST['submit_connect']))) {
* selecting the source and target databases using these links * selecting the source and target databases using these links
*/ */
foreach ($cons as $con) { foreach ($cons as $con) {
if (${"{$con}_connection"}!=null) if (${"{$con}_connection"} != null) {
${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); ${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"});
else } else {
${"{$con}_link"} = null; ${"{$con}_link"} = null;
${"{$con}_db_selected"} = PMA_DBI_select_db(${"{$con}_db"}, ${"{$con}_link"});
} }
${"{$con}_db_selected"} = PMA_DBI_select_db(${"{$con}_db"}, ${"{$con}_link"});
} // end foreach ($cons as $con)
if (($src_db_selected != 1) || ($trg_db_selected != 1)) { if (($src_db_selected != 1) || ($trg_db_selected != 1)) {
/** /**
@@ -185,8 +186,7 @@ if ((isset($_REQUEST['submit_connect']))) {
*/ */
$criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment'); $criteria = array('Field', 'Type', 'Null', 'Collation', 'Key', 'Default', 'Comment');
for($i=0; $i< sizeof($matching_tables); $i++) for($i = 0; $i < sizeof($matching_tables); $i++) {
{
/** /**
* Finding out all the differences structure, data and index diff for all the matching tables only * Finding out all the differences structure, data and index diff for all the matching tables only
*/ */
@@ -200,8 +200,7 @@ if ((isset($_REQUEST['submit_connect']))) {
$add_indexes_array, $alter_indexes_array,$remove_indexes_array, $i); $add_indexes_array, $alter_indexes_array,$remove_indexes_array, $i);
} }
for($j=0; $j< sizeof($source_tables_uncommon); $j++) for($j = 0; $j < sizeof($source_tables_uncommon); $j++) {
{
/** /**
* Finding out the number of rows to be added in tables that need to be added in target database * Finding out the number of rows to be added in tables that need to be added in target database
*/ */
@@ -285,8 +284,7 @@ if ((isset($_REQUEST['submit_connect']))) {
/** /**
* Display the matching tables' names and difference, first * Display the matching tables' names and difference, first
*/ */
for($i = 0; $i < count($matching_tables); $i++) for($i = 0; $i < count($matching_tables); $i++) {
{
$num_of_updates = 0; $num_of_updates = 0;
$num_of_insertions = 0; $num_of_insertions = 0;
/** /**
@@ -381,8 +379,7 @@ if ((isset($_REQUEST['submit_connect']))) {
/** /**
* Displays the tables' names present in source but missing from target * Displays the tables' names present in source but missing from target
*/ */
for ($j = 0; $j < count($source_tables_uncommon); $j++) for ($j = 0; $j < count($source_tables_uncommon); $j++) {
{
$odd_row = !$odd_row; $odd_row = !$odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -404,8 +401,7 @@ if ((isset($_REQUEST['submit_connect']))) {
echo '</td> echo '</td>
</tr>'; </tr>';
} }
foreach ($target_tables_uncommon as $tbl_nc_name) foreach ($target_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -422,8 +418,7 @@ if ((isset($_REQUEST['submit_connect']))) {
<th>Target Database: ' . $trg_db . '</th> <th>Target Database: ' . $trg_db . '</th>
</tr>'; </tr>';
$odd_row = false; $odd_row = false;
foreach ($matching_tables as $tbl_name) foreach ($matching_tables as $tbl_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -431,8 +426,7 @@ if ((isset($_REQUEST['submit_connect']))) {
<td> ' .$tbl_name . '</td>'; <td> ' .$tbl_name . '</td>';
echo '</tr>'; echo '</tr>';
} }
foreach ($source_tables_uncommon as $tbl_nc_name) foreach ($source_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -440,8 +434,7 @@ if ((isset($_REQUEST['submit_connect']))) {
<td>' .$tbl_nc_name . "\n" . ' (Not present)</td> <td>' .$tbl_nc_name . "\n" . ' (Not present)</td>
</tr>'; </tr>';
} }
foreach ($target_tables_uncommon as $tbl_nc_name) foreach ($target_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -497,7 +490,7 @@ if ((isset($_REQUEST['submit_connect']))) {
echo '</form>'; echo '</form>';
} }
} }
} } // end if ((isset($_REQUEST['submit_connect'])))
/** /**
* Display the page when 'Apply Selected Changes' is pressed * Display the page when 'Apply Selected Changes' is pressed
@@ -548,11 +541,12 @@ if (isset($_REQUEST['Table_ids'])) {
* Creating link object for source and target databases * Creating link object for source and target databases
*/ */
foreach ($cons as $con) { foreach ($cons as $con) {
if (${"{$con}_type"}=="rmt") if (${"{$con}_type"}=="rmt") {
${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"}); ${"{$con}_link"} = PMA_DBI_connect(${"{$con}_username"}, ${"{$con}_password"}, $is_controluser = false, ${"{$con}_server"});
else } else {
${"{$con}_link"} = null; ${"{$con}_link"} = null;
} }
} // end foreach ($cons as $con)
/** /**
* Initializing arrays to save the table ids whose data and structure difference is to be applied * Initializing arrays to save the table ids whose data and structure difference is to be applied
@@ -562,8 +556,7 @@ if (isset($_REQUEST['Table_ids'])) {
$uncommon_table_structure_diff = array(); //stores id of uncommon tables having structure difference $uncommon_table_structure_diff = array(); //stores id of uncommon tables having structure difference
$uncommon_table_data_diff = array(); //stores id of uncommon tables having data difference $uncommon_table_data_diff = array(); //stores id of uncommon tables having data difference
for ($i=0; isset($_REQUEST[$i]); $i++ ) for ($i = 0; isset($_REQUEST[$i]); $i++ ) {
{
if (isset($_REQUEST[$i])) { if (isset($_REQUEST[$i])) {
$table_id = split("US", $_REQUEST[$i]); $table_id = split("US", $_REQUEST[$i]);
if (isset($table_id[1])) { if (isset($table_id[1])) {
@@ -583,7 +576,7 @@ if (isset($_REQUEST['Table_ids'])) {
$matching_table_data_diff[] = $table_id[1]; $matching_table_data_diff[] = $table_id[1];
} }
} }
} } // end for
/** /**
* Applying the structure difference on selected matching tables * Applying the structure difference on selected matching tables
*/ */
@@ -755,8 +748,7 @@ if (isset($_REQUEST['Table_ids'])) {
<th> Difference </th> <th> Difference </th>
</tr>'; </tr>';
$odd_row = false; $odd_row = false;
for($i = 0; $i < count($matching_tables); $i++) for($i = 0; $i < count($matching_tables); $i++) {
{
$odd_row = !$odd_row; $odd_row = !$odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -834,8 +826,7 @@ if (isset($_REQUEST['Table_ids'])) {
$_SESSION['update_array'] = $update_array; $_SESSION['update_array'] = $update_array;
$_SESSION['insert_array'] = $insert_array; $_SESSION['insert_array'] = $insert_array;
for ($j = 0; $j < count($source_tables_uncommon); $j++) for ($j = 0; $j < count($source_tables_uncommon); $j++) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -859,8 +850,7 @@ if (isset($_REQUEST['Table_ids'])) {
* Display the difference only when it has not been applied * Display the difference only when it has not been applied
*/ */
if (!(in_array($j, $uncommon_table_data_diff))) { if (!(in_array($j, $uncommon_table_data_diff))) {
if (isset($row_count[$j]) && ($row_count > 0)) if (isset($row_count[$j]) && ($row_count > 0)) {
{
echo '<img class="icon" src="' . $pmaThemeImage . 'new_data.jpg" width="29"'.' height="29" echo '<img class="icon" src="' . $pmaThemeImage . 'new_data.jpg" width="29"'.' height="29"
alt="Click to Select" onmouseover="change_Image(this);" onmouseout="change_Image(this);" alt="Click to Select" onmouseover="change_Image(this);" onmouseout="change_Image(this);"
onClick="showDetails('."'UD".$j."'".','."'".null."'".','."'".$row_count[$j]."'".','."'" onClick="showDetails('."'UD".$j."'".','."'".null."'".','."'".$row_count[$j]."'".','."'"
@@ -882,10 +872,9 @@ if (isset($_REQUEST['Table_ids'])) {
/** /**
* Dispalying the target database tables * Displaying the target database tables
*/ */
foreach ($target_tables_uncommon as $tbl_nc_name) foreach ($target_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -899,8 +888,7 @@ if (isset($_REQUEST['Table_ids'])) {
<th>Target Database: ' . $trg_db . '</th> <th>Target Database: ' . $trg_db . '</th>
</tr>'; </tr>';
$odd_row = false; $odd_row = false;
foreach ($matching_tables as $tbl_name) foreach ($matching_tables as $tbl_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -908,8 +896,7 @@ if (isset($_REQUEST['Table_ids'])) {
<td> ' .$tbl_name . '</td>'; <td> ' .$tbl_name . '</td>';
echo '</tr>'; echo '</tr>';
} }
foreach ($source_tables_uncommon as $tbl_nc_name) foreach ($source_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -922,8 +909,7 @@ if (isset($_REQUEST['Table_ids'])) {
echo ' echo '
</tr>'; </tr>';
} }
foreach ($target_tables_uncommon as $tbl_nc_name) foreach ($target_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -982,7 +968,7 @@ if (isset($_REQUEST['Table_ids'])) {
} }
/** /**
* Dispalys the page when 'Synchronize Databases' is pressed. * Displays the page when 'Synchronize Databases' is pressed.
*/ */
if (isset($_REQUEST['synchronize_db'])) { if (isset($_REQUEST['synchronize_db'])) {
@@ -1024,7 +1010,7 @@ if (isset($_REQUEST['synchronize_db'])) {
*/ */
echo '<div class="success">Target database has been synchronized with source database. </div>'; echo '<div class="success">Target database has been synchronized with source database. </div>';
/** /**
* Dispalying all the tables of source and target database and now no difference is there. * Displaying all the tables of source and target database and now no difference is there.
*/ */
echo '<div id="serverstatus" style = "overflow: auto; width: 1050px; height: 250px; echo '<div id="serverstatus" style = "overflow: auto; width: 1050px; height: 250px;
border-left: 1px gray solid; border-bottom: 1px gray solid; border-left: 1px gray solid; border-bottom: 1px gray solid;
@@ -1046,8 +1032,7 @@ if (isset($_REQUEST['synchronize_db'])) {
<td></td> <td></td>
</tr>'; </tr>';
} }
for ($j = 0; $j < count($source_tables_uncommon); $j++) for ($j = 0; $j < count($source_tables_uncommon); $j++) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -1056,8 +1041,7 @@ if (isset($_REQUEST['synchronize_db'])) {
echo '<td></td> echo '<td></td>
</tr>'; </tr>';
} }
foreach ($target_tables_uncommon as $tbl_nc_name) foreach ($target_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -1071,8 +1055,7 @@ if (isset($_REQUEST['synchronize_db'])) {
<th>Target Database: ' . $trg_db . '</th> <th>Target Database: ' . $trg_db . '</th>
</tr>'; </tr>';
$odd_row = false; $odd_row = false;
foreach ($matching_tables as $tbl_name) foreach ($matching_tables as $tbl_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -1080,8 +1063,7 @@ if (isset($_REQUEST['synchronize_db'])) {
<td> ' .$tbl_name . '</td>'; <td> ' .$tbl_name . '</td>';
echo '</tr>'; echo '</tr>';
} }
foreach ($source_tables_uncommon as $tbl_nc_name) foreach ($source_tables_uncommon as $tbl_nc_name) {
{
$odd_row = !$odd_row; $odd_row = !$odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -1089,8 +1071,7 @@ if (isset($_REQUEST['synchronize_db'])) {
<td>' .$tbl_nc_name . "\n" . ' </td> <td>' .$tbl_nc_name . "\n" . ' </td>
</tr>'; </tr>';
} }
foreach ($target_tables_uncommon as $tbl_nc_name) foreach ($target_tables_uncommon as $tbl_nc_name) {
{
$odd_row = ! $odd_row; $odd_row = ! $odd_row;
echo '<tr height="32" class=" '; echo '<tr height="32" class=" ';
echo $odd_row ? 'odd' : 'even'; echo $odd_row ? 'odd' : 'even';
@@ -1115,19 +1096,16 @@ if (isset($_REQUEST['synchronize_db'])) {
/** /**
* Applying all sorts of differences for each matching table * Applying all sorts of differences for each matching table
*/ */
for($p=0; $p <sizeof($matching_tables);$p++) for($p = 0; $p <sizeof($matching_tables); $p++) {
{
/** /**
* If the check box is checked for deleting previous rows from the target database tables then * If the check box is checked for deleting previous rows from the target database tables then
* first find out rows to be deleted and then delete the rows. * first find out rows to be deleted and then delete the rows.
*/ */
if (isset($_REQUEST['delete_rows'])) { if (isset($_REQUEST['delete_rows'])) {
PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables, $p, $target_tables_keys, $matching_tables_keys, PMA_findDeleteRowsFromTargetTables($delete_array, $matching_tables, $p, $target_tables_keys, $matching_tables_keys,
$trg_db, $trg_link, $src_db, $src_link); $trg_db, $trg_link, $src_db, $src_link);
if (isset($delete_array[$p])) { if (isset($delete_array[$p])) {
PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $p, $target_tables_keys, $delete_array, true); PMA_deleteFromTargetTable($trg_db, $trg_link, $matching_tables, $p, $target_tables_keys, $delete_array, true);
unset($delete_array[$p]); unset($delete_array[$p]);
} }
@@ -1177,8 +1155,7 @@ if (isset($_REQUEST['synchronize_db'])) {
/** /**
* Creating and populating tables present in source but absent from target database. * Creating and populating tables present in source but absent from target database.
*/ */
for($q=0; $q < sizeof($source_tables_uncommon) ;$q++) for($q = 0; $q < sizeof($source_tables_uncommon) ;$q++) {
{
if (isset($uncommon_tables[$q])) { if (isset($uncommon_tables[$q])) {
PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, true); PMA_createTargetTables($src_db, $trg_db, $src_link, $trg_link, $source_tables_uncommon, $q, $uncommon_tables_fields, true);
} }
@@ -1263,9 +1240,10 @@ if (isset($_REQUEST['synchronize_db'])) {
'; ';
foreach ($databases as $db) { foreach ($databases as $db) {
if ($db['SCHEMA_NAME'] != 'mysql' if ($db['SCHEMA_NAME'] != 'mysql'
&& $db['SCHEMA_NAME'] != 'information_schema') && $db['SCHEMA_NAME'] != 'information_schema') {
echo ' <option>' . $db['SCHEMA_NAME'] . '</option>'."\n"; echo ' <option>' . $db['SCHEMA_NAME'] . '</option>'."\n";
} }
}
echo ' echo '
</select> </select>
</td> </td>