log-bin=mysql-bin log-error=mysql-bin.err ";'."\n".
'var c_ignore = "binlog_ignore_db=";'."\n".
'var c_do = "binlog_do_db=";'."\n".
'$(\'db_reset_href\').addEvent(\'click\', function() {'."\n".
' $(\'db_select\').getSelected().each(function(el) {'."\n".
' el.selected = false;'."\n".
' });'."\n".
' $(\'rep\').set(\'html\', c_text);'."\n".
'});'."\n".
'$(\'db_type\').addEvent(\'change\',function() {'."\n".
' if ($(\'db_type\').getSelected().get(\'value\')=="all")'."\n".
' $(\'rep\').set(\'html\', c_text+c_ignore+c_output);'."\n".
' else'."\n".
' $(\'rep\').set(\'html\', c_text+c_do+c_output);'."\n".
'});'."\n".
'$(\'db_select\').addEvent(\'change\',function() {'."\n".
' var count = 0;'."\n".
' $(\'db_select\').getSelected().each(function(el) { '."\n".
' if (count==0)'."\n".
' c_output = el.get(\'value\');'."\n".
' else'."\n".
' c_output = c_output + \',\' +el.get(\'value\');'."\n".
' count=count+1;'."\n".
' if ($(\'db_select\').getSelected().length==count) {'."\n".
' if ($(\'db_type\').getSelected().get(\'value\')=="all")'."\n".
' $(\'rep\').set(\'html\', c_text+c_ignore+c_output);'."\n".
' else'."\n".
' $(\'rep\').set(\'html\', c_text+c_do+c_output);'."\n".
' count = 0;'."\n".
' }'."\n".
' });'."\n".
'});'."\n";
$jscode['slave_control'] =
'divShowHideFunc(\'slave_status_href\', \'replication_slave_section\');'."\n".
'divShowHideFunc(\'slave_control_href\', \'slave_control_gui\');'."\n".
'divShowHideFunc(\'slave_errormanagement_href\',\'slave_errormanagement_gui\'); '."\n";
$jscode['slave_control_sync'] =
'divShowHideFunc(\'slave_synchronization_href\', \'slave_synchronization_gui\');'."\n";
/**
* returns code for selecting databases
*
* @return String HTML code
*/
function PMA_replication_db_multibox()
{
$multi_values = '';
$multi_values .= '';
$multi_values .= "\n";
foreach ($GLOBALS['pma']->databases as $current_db) {
if (!empty($selectall) || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))) {
$is_selected = ' selected="selected"';
} else {
$is_selected = '';
}
$current_db = htmlspecialchars($current_db);
$multi_values .= ' ' . $current_db . ' ' . "\n";
} // end while
$multi_values .= "\n";
$multi_values .= ' ';
$multi_values .= '' . $GLOBALS['strUncheckAll'] . ' ';
return $multi_values;
}
/**
* prints out code for changing master
*
* @param String $submitname - submit button name
*/
function PMA_replication_gui_changemaster($submitname) {
global $username_length;
global $hostname_length;
echo '
'."\n";
}
/**
* This function prints out table with replication status.
*
* @param String type - either master or slave
* @param boolean $hidden - if true, then default style is set to hidden, default value false
* @param boolen $title - if true, then title is displayed, default true
*/
function PMA_replication_print_status_table($type, $hidden = false, $title = true) {
global ${"{$type}_variables"};
global ${"{$type}_variables_alerts"};
global ${"{$type}_variables_oks"};
global ${"server_{$type}_replication"};
global ${"strReplicationStatus_{$type}"};
// TODO check the Masters server id?
// seems to default to '1' when queried via SHOW VARIABLES , but resulted in error on the master when slave connects
// [ERROR] Error reading packet from server: Misconfigured master - server id was not set ( server_errno=1236)
// [ERROR] Got fatal error 1236: 'Misconfigured master - server id was not set' from master when reading data from binary log
//
//$server_id = PMA_DBI_fetch_value("SHOW VARIABLES LIKE 'server_id'", 0, 1);
echo ' '."\n";
if ($title) {
echo '
'.${"strReplicationStatus_{$type}"} .''."\n";
} else {
echo '
'."\n";
}
echo '
'."\n";
echo ' '."\n";
echo ' '."\n";
echo ' '. $GLOBALS['strVar'] .' '."\n";
echo ' '. $GLOBALS['strValue'] .' '."\n";
echo ' '."\n";
echo ' '."\n";
echo ' '."\n";
$odd_row = true;
foreach (${"{$type}_variables"} as $variable) {
echo ' '."\n";
echo ' '."\n";
echo $variable."\n";
echo ' '."\n";
echo ' '."\n";
// TODO change to regexp or something, to allow for negative match
if (isset(${"{$type}_variables_alerts"}[$variable])
&& ${"{$type}_variables_alerts"}[$variable] == ${"server_{$type}_replication"}[0][$variable]
) {
echo ''."\n";
} elseif (isset(${"{$type}_variables_oks"}[$variable])
&& ${"{$type}_variables_oks"}[$variable] == ${"server_{$type}_replication"}[0][$variable]
) {
echo ''."\n";
} else {
echo ''."\n";
}
echo ${"server_{$type}_replication"}[0][$variable];
echo ' '."\n";
echo ' '."\n";
echo ' '."\n";
$odd_row = !$odd_row;
}
echo ' '."\n";
echo '
'."\n";
echo '
'."\n";
echo '
'."\n";
}
/**
* Prints table with slave users connected to this master
*
* @param boolean $hidden - if true, then default style is set to hidden, default value false
*/
function PMA_replication_print_slaves_table($hidden = false) {
// Fetch data
$data = PMA_DBI_fetch_result('SHOW SLAVE HOSTS', null, null);
echo ' ' . "\n";
echo ' ' . "\n";
echo '
' . "\n";
echo ' ' . "\n";
echo ' '."\n";
echo ' ' . $GLOBALS['strBinLogServerId'] . ' ' . "\n";
echo ' ' . $GLOBALS['strHost'] . ' ' . "\n";
echo ' '."\n";
echo ' '."\n";
echo ' '."\n";
$odd_row = true;
foreach ($data as $slave) {
echo ' ' . "\n";
echo ' ' . $slave['Server_id'] . ' ' . "\n";
echo ' ' . $slave['Host'] . ' ' . "\n";
echo ' ' . "\n";
$odd_row = !$odd_row;
}
echo ' '."\n";
echo '
'."\n";
echo '
'."\n";
PMA_Message::notice('strReplicationShowConnectedSlavesNote')->display();
echo '
'."\n";
echo '
'."\n";
}
/**
* Print code to add a replication slave user to the master
*/
function PMA_replication_gui_master_addslaveuser() {
$fields_info = PMA_DBI_get_fields('mysql', 'user');
$username_length = 16;
$hostname_length = 41;
foreach ($fields_info as $key => $val) {
if ($val['Field'] == 'User') {
strtok($val['Type'], '()');
$v = strtok('()');
if (is_int($v)) {
$username_length = $v;
}
} elseif ($val['Field'] == 'Host') {
strtok($val['Type'], '()');
$v = strtok('()');
if (is_int($v)) {
$hostname_length = $v;
}
}
}
unset($fields_info);
if (isset($GLOBALS['username']) && strlen($GLOBALS['username']) === 0) {
$GLOBALS['pred_username'] = 'any';
}
echo ''."\n";
echo '
'."\n";
echo '
'."\n";
}
?>