Fix indentation for gsoc replication code
make it match the included modeline, and fixed some other spacing issues
This commit is contained in:
@@ -341,7 +341,10 @@ foreach ($tables as $keyname => $each_table) {
|
|||||||
if ($server_slave_status) {
|
if ($server_slave_status) {
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if ((strlen(array_search($truename, $server_slave_Do_Table))>0) || (strlen(array_search($db, $server_slave_Do_DB))>0) || (count($server_slave_Do_DB)==1 && count($server_slave_Ignore_DB)==1)) {
|
if ((strlen(array_search($truename, $server_slave_Do_Table)) > 0)
|
||||||
|
|| (strlen(array_search($db, $server_slave_Do_DB))>0)
|
||||||
|
|| (count($server_slave_Do_DB)==1 && count($server_slave_Ignore_DB)==1)
|
||||||
|
) {
|
||||||
$do = true;
|
$do = true;
|
||||||
}
|
}
|
||||||
foreach ($server_slave_Wild_Do_Table as $table) {
|
foreach ($server_slave_Wild_Do_Table as $table) {
|
||||||
|
@@ -136,10 +136,13 @@ function PMA_replication_slave_control ($action, $control=null, $link=null)
|
|||||||
$control = strtoupper($control);
|
$control = strtoupper($control);
|
||||||
|
|
||||||
|
|
||||||
if ($action!="START" && $action!="STOP")
|
if ($action != "START" && $action != "STOP") {
|
||||||
return -1;
|
return -1;
|
||||||
if ($control!="SQL_THREAD" && $control!="IO_THREAD" && $control!=null)
|
}
|
||||||
|
if ($control != "SQL_THREAD" && $control != "IO_THREAD" && $control != null) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return PMA_DBI_try_query($action." SLAVE ".$control.";", $link);
|
return PMA_DBI_try_query($action." SLAVE ".$control.";", $link);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -156,8 +159,9 @@ function PMA_replication_slave_control ($action, $control=null, $link=null)
|
|||||||
*/
|
*/
|
||||||
function PMA_replication_slave_change_master($user, $password, $host, $port, $pos, $stop = true, $start = true, $link = null)
|
function PMA_replication_slave_change_master($user, $password, $host, $port, $pos, $stop = true, $start = true, $link = null)
|
||||||
{
|
{
|
||||||
if ($stop)
|
if ($stop) {
|
||||||
PMA_replication_slave_control("STOP", null, $link);
|
PMA_replication_slave_control("STOP", null, $link);
|
||||||
|
}
|
||||||
|
|
||||||
$out = PMA_DBI_try_query('CHANGE MASTER TO '.
|
$out = PMA_DBI_try_query('CHANGE MASTER TO '.
|
||||||
'MASTER_HOST=\''.$host.'\','.
|
'MASTER_HOST=\''.$host.'\','.
|
||||||
@@ -224,10 +228,12 @@ function PMA_replication_master_replicated_dbs($link=null)
|
|||||||
$do_db = array();
|
$do_db = array();
|
||||||
$ignore_db = array();
|
$ignore_db = array();
|
||||||
|
|
||||||
if (!empty($data[0]['Binlog_Do_DB']))
|
if (!empty($data[0]['Binlog_Do_DB'])) {
|
||||||
$do_db = explode($data[0]['Binlog_Do_DB'], ',');
|
$do_db = explode($data[0]['Binlog_Do_DB'], ',');
|
||||||
if (!empty($data[0]['Binlog_Ignore_DB']))
|
}
|
||||||
|
if (!empty($data[0]['Binlog_Ignore_DB'])) {
|
||||||
$ignore_db = explode($data[0]['Binlog_Ignore_DB'], ',');
|
$ignore_db = explode($data[0]['Binlog_Ignore_DB'], ',');
|
||||||
|
}
|
||||||
|
|
||||||
$tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link);
|
$tmp_alldbs = PMA_DBI_query('SHOW DATABASES;', $link);
|
||||||
while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
|
while ($tmp_row = PMA_DBI_fetch_row($tmp_alldbs)) {
|
||||||
@@ -270,6 +276,7 @@ function PMA_replication_synchronize_DB($db, $src_link, $trg_link, $data=true)
|
|||||||
|
|
||||||
$trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
|
$trg_tables = PMA_DBI_get_tables($trg_db, $trg_link);
|
||||||
$target_tables_num = sizeof($trg_tables);
|
$target_tables_num = sizeof($trg_tables);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initializing arrays to save table names
|
* initializing arrays to save table names
|
||||||
*/
|
*/
|
||||||
@@ -348,8 +355,6 @@ function PMA_replication_synchronize_DB($db, $src_link, $trg_link, $data=true)
|
|||||||
$add_indexes_array, $alter_indexes_array,$remove_indexes_array, $counter);
|
$add_indexes_array, $alter_indexes_array,$remove_indexes_array, $counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$matching_table_data_diff = array();
|
$matching_table_data_diff = array();
|
||||||
$matching_table_structure_diff = array();
|
$matching_table_structure_diff = array();
|
||||||
$uncommon_table_structure_diff = array();
|
$uncommon_table_structure_diff = array();
|
||||||
|
@@ -164,12 +164,19 @@ function PMA_replication_print_status_table ($type, $hidden=false, $title=true)
|
|||||||
echo ' </td>'."\n";
|
echo ' </td>'."\n";
|
||||||
echo ' <td class="value">'."\n";
|
echo ' <td class="value">'."\n";
|
||||||
|
|
||||||
if (isset(${"{$type}_variables_alerts"}[$variable]) && ${"{$type}_variables_alerts"}[$variable] == ${"server_{$type}_replication"}[0][$variable])
|
if (isset(${"{$type}_variables_alerts"}[$variable])
|
||||||
|
&& ${"{$type}_variables_alerts"}[$variable] == ${"server_{$type}_replication"}[0][$variable]
|
||||||
|
) {
|
||||||
echo '<span class="attention">'."\n";
|
echo '<span class="attention">'."\n";
|
||||||
if (isset(${"{$type}_variables_oks"}[$variable]) && ${"{$type}_variables_oks"}[$variable] == ${"server_{$type}_replication"}[0][$variable])
|
}
|
||||||
|
|
||||||
|
if (isset(${"{$type}_variables_oks"}[$variable])
|
||||||
|
&& ${"{$type}_variables_oks"}[$variable] == ${"server_{$type}_replication"}[0][$variable]
|
||||||
|
) {
|
||||||
echo '<span class="allfine">'."\n";
|
echo '<span class="allfine">'."\n";
|
||||||
else
|
} else {
|
||||||
echo '<span>'."\n";
|
echo '<span>'."\n";
|
||||||
|
}
|
||||||
echo ${"server_{$type}_replication"}[0][$variable];
|
echo ${"server_{$type}_replication"}[0][$variable];
|
||||||
echo '</span>'."\n";
|
echo '</span>'."\n";
|
||||||
|
|
||||||
|
@@ -268,11 +268,13 @@ if ($databases_count > 0) {
|
|||||||
} else {
|
} else {
|
||||||
$key = array_search($current["SCHEMA_NAME"], ${"server_{$type}_Do_DB"});
|
$key = array_search($current["SCHEMA_NAME"], ${"server_{$type}_Do_DB"});
|
||||||
|
|
||||||
if (strlen($key)>0 || (${"server_{$type}_Do_DB"}[0]=="" && count(${"server_{$type}_Do_DB"})==1)) // if ($key != null) did not work for index "0"
|
if (strlen($key) > 0 || (${"server_{$type}_Do_DB"}[0] == "" && count(${"server_{$type}_Do_DB"}) == 1)) {
|
||||||
|
// if ($key != null) did not work for index "0"
|
||||||
echo '<img class="icon" src="' . $pmaThemeImage . 's_success.png" width="16" height="16" alt="REPLICATED" />' . "\n";
|
echo '<img class="icon" src="' . $pmaThemeImage . 's_success.png" width="16" height="16" alt="REPLICATED" />' . "\n";
|
||||||
else
|
} else {
|
||||||
echo '';
|
echo '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
}
|
}
|
||||||
|
@@ -53,8 +53,9 @@ if (isset($GLOBALS['sr_take_action'])) {
|
|||||||
$_SESSION['replication']['sr_action_info'] = $strReplicationUnknownError;
|
$_SESSION['replication']['sr_action_info'] = $strReplicationUnknownError;
|
||||||
$url = $sr['hostname'];
|
$url = $sr['hostname'];
|
||||||
|
|
||||||
if ($sr['port']!='')
|
if ($sr['port'] != '') {
|
||||||
$url .= ':' . $sr['port'];
|
$url .= ':' . $sr['port'];
|
||||||
|
}
|
||||||
|
|
||||||
$check_master = null;
|
$check_master = null;
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
@@ -128,10 +129,11 @@ if (isset($GLOBALS['sr_take_action'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
if (isset($GLOBALS['repl_data']))
|
if (isset($GLOBALS['repl_data'])) {
|
||||||
$data = true;
|
$data = true;
|
||||||
else
|
} else {
|
||||||
$data = false;
|
$data = false;
|
||||||
|
}
|
||||||
foreach ($dblist as $db) {
|
foreach ($dblist as $db) {
|
||||||
PMA_replication_synchronize_db($db, $src_link, $trg_link, $data);
|
PMA_replication_synchronize_db($db, $src_link, $trg_link, $data);
|
||||||
}
|
}
|
||||||
@@ -389,24 +391,32 @@ if (!isset($GLOBALS['repl_clear_scr'])) {
|
|||||||
$_url_params['sr_take_action'] = true;
|
$_url_params['sr_take_action'] = true;
|
||||||
$_url_params['sr_slave_server_control'] = true;
|
$_url_params['sr_slave_server_control'] = true;
|
||||||
|
|
||||||
if ($server_slave_replication[0]['Slave_IO_Running']=='No')
|
if ($server_slave_replication[0]['Slave_IO_Running'] == 'No') {
|
||||||
$_url_params['sr_slave_action'] = 'start';
|
$_url_params['sr_slave_action'] = 'start';
|
||||||
else
|
} else {
|
||||||
$_url_params['sr_slave_action'] = 'stop';
|
$_url_params['sr_slave_action'] = 'stop';
|
||||||
|
}
|
||||||
|
|
||||||
$_url_params['sr_slave_control_parm'] = 'IO_THREAD';
|
$_url_params['sr_slave_control_parm'] = 'IO_THREAD';
|
||||||
$slave_control_io_link = PMA_generate_common_url($_url_params);
|
$slave_control_io_link = PMA_generate_common_url($_url_params);
|
||||||
|
|
||||||
if ($server_slave_replication[0]['Slave_SQL_Running']=='No')
|
if ($server_slave_replication[0]['Slave_SQL_Running'] == 'No') {
|
||||||
$_url_params['sr_slave_action'] = 'start';
|
$_url_params['sr_slave_action'] = 'start';
|
||||||
else
|
} else {
|
||||||
$_url_params['sr_slave_action'] = 'stop';
|
$_url_params['sr_slave_action'] = 'stop';
|
||||||
|
}
|
||||||
|
|
||||||
$_url_params['sr_slave_control_parm'] = 'SQL_THREAD';
|
$_url_params['sr_slave_control_parm'] = 'SQL_THREAD';
|
||||||
$slave_control_sql_link = PMA_generate_common_url($_url_params);
|
$slave_control_sql_link = PMA_generate_common_url($_url_params);
|
||||||
|
|
||||||
if ($server_slave_replication[0]['Slave_IO_Running']=='No' || $server_slave_replication[0]['Slave_SQL_Running']=='No')
|
if ($server_slave_replication[0]['Slave_IO_Running'] == 'No'
|
||||||
|
|| $server_slave_replication[0]['Slave_SQL_Running'] == 'No'
|
||||||
|
) {
|
||||||
$_url_params['sr_slave_action'] = 'start';
|
$_url_params['sr_slave_action'] = 'start';
|
||||||
else
|
} else {
|
||||||
$_url_params['sr_slave_action'] = 'stop';
|
$_url_params['sr_slave_action'] = 'stop';
|
||||||
|
}
|
||||||
|
|
||||||
$_url_params['sr_slave_control_parm'] = null;
|
$_url_params['sr_slave_control_parm'] = null;
|
||||||
$slave_control_full_link = PMA_generate_common_url($_url_params);
|
$slave_control_full_link = PMA_generate_common_url($_url_params);
|
||||||
|
|
||||||
|
@@ -708,9 +708,9 @@ if ($server_master_status || $server_slave_status)
|
|||||||
|
|
||||||
foreach ($replication_types as $type)
|
foreach ($replication_types as $type)
|
||||||
{
|
{
|
||||||
if (${"server_{$type}_status"})
|
if (${"server_{$type}_status"}) {
|
||||||
PMA_replication_print_status_table($type);
|
PMA_replication_print_status_table($type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unset($types);
|
unset($types);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user