clarify code

This commit is contained in:
Marc Delisle
2010-07-08 08:29:27 -04:00
parent c1be602a1e
commit 90ce4c77b3
2 changed files with 19 additions and 16 deletions

View File

@@ -360,24 +360,24 @@ foreach ($tables as $keyname => $each_table) {
) { ) {
$do = true; $do = true;
} }
foreach ($server_slave_Wild_Do_Table as $table) { foreach ($server_slave_Wild_Do_Table as $db_table) {
if (($db == PMA_replication_strout($table)) && (preg_match("@^" . substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true)) - 1) . "@", $truename))) $table_part = PMA_extract_db_or_table($db_table, 'table');
if (($db == PMA_extract_db_or_table($db_table, 'db')) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))) {
$do = true; $do = true;
} }
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0)) { if ((strlen(array_search($truename, $server_slave_Ignore_Table)) > 0) || (strlen(array_search($db, $server_slave_Ignore_DB)) > 0)) {
$ignored = true; $ignored = true;
} }
foreach ($server_slave_Wild_Ignore_Table as $table) { foreach ($server_slave_Wild_Ignore_Table as $db_table) {
if (($db == PMA_replication_strout($table)) && (preg_match("@^" . substr(PMA_replication_strout($table, true), 0, strlen(PMA_replication_strout($table, true)) - 1) . "@", $truename))) $table_part = PMA_extract_db_or_table($db_table, 'table');
if (($db == PMA_extract_db_or_table($db_table)) && (preg_match("@^" . substr($table_part, 0, strlen($table_part) - 1) . "@", $truename))) {
$ignored = true; $ignored = true;
} }
}/* elseif ($server_master_status) { }
if ((strlen(array_search($db, $server_master_Do_DB))>0) || count($server_master_Do_DB)==1) unset($table_part);
$do = true; }
elseif ((strlen(array_search($db, $server_master_Ignore_DB))>0) || count($server_master_Ignore_DB)==1)
$ignored = true;
}*/
?> ?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>"> <tr class="<?php echo $odd_row ? 'odd' : 'even'; $odd_row = ! $odd_row; ?>">
<td align="center"> <td align="center">

View File

@@ -116,14 +116,17 @@ foreach ($replication_types as $type) {
/** /**
* @param $string - * @param $string contains "dbname.tablename"
* @param $table - * @param $what what to extract (db|table)
* @return * @return $string the extracted part
*/ */
function PMA_replication_strout($string, $table = false) { function PMA_extract_db_or_table($string, $what = 'db') {
$list = explode(".", $string); $list = explode(".", $string);
if ('db' == $what) {
return $list[(int)$table]; return $list[0];
} else {
return $list[1];
}
} }
/** /**
* @param String $action - possible values: START or STOP * @param String $action - possible values: START or STOP