Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix replication status output in Server > Databases #12416

Merged
merged 1 commit into from Jul 29, 2016

Conversation

rpv-tomsk
Copy link
Contributor

Fix replication status output in Server > Databases

Broken by refactoring done in 829a84b
Incorrectly fixed by c4710c3

Previously, 'libraries/replication.inc.php' has following code:

           ${"server_{$type}_Do_DB"} = explode(
                ",", $server_master_replication[0]["Binlog_Do_DB"]
            );

This provide following result on empty value of 'Binlog_Do_DB':

# php -r '$v = explode(",",""); print var_export($v);'
array (
  0 => '',
)

... and 's_success' displayed as result of condition check.

                if (strlen($key) > 0
                    || ($replication_info[$type]['Do_DB'][0] == ""
                    && count($replication_info[$type]['Do_DB']) == 1)
                ) {
                    // if ($key != null) did not work for index "0"
                    $out .= PMA_Util::getIcon('s_success.png', __('Replicated'));
                }

Current code (4.6.3) has refactored version

function PMA_fillReplicationInfo(
    $type, $replicationInfoKey, $mysqlInfo, $mysqlKey
) {
    $GLOBALS['replication_info'][$type][$replicationInfoKey]
        = empty($mysqlInfo[$mysqlKey])
            ? array()
            : explode(
                ",",
                $mysqlInfo[$mysqlKey]
            );

    return $GLOBALS['replication_info'][$type][$replicationInfoKey];
}

and it provides an empty array on empty value of 'Binlog_Do_DB'.

As result, no 's_success' is displayed.

Proposed patch fixed this problem for my phpMyAdmin-4.6.3 setup.

Superseedes #12410 (changed PR target branch)

Broken by 829a84b refactoring.
Incorrectly fixed in c4710c3

Signed-off-by: Pavel Rochnyack <pavel2000@ngs.ru>
@codecov-io
Copy link

codecov-io commented Jul 29, 2016

Current coverage is 50.08% (diff: 100%)

Merging #12416 into QA_4_6 will increase coverage by <.01%

@@             QA_4_6     #12416   diff @@
==========================================
  Files           486        486          
  Lines         80994      80992     -2   
  Methods        2122       2122          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          40562      40562          
+ Misses        40432      40430     -2   
  Partials          0          0          

Powered by Codecov. Last update 76f94e4...b705dc5

@nijel nijel self-assigned this Jul 29, 2016
@nijel nijel merged commit 74016bc into phpmyadmin:QA_4_6 Jul 29, 2016
@nijel
Copy link
Contributor

nijel commented Jul 29, 2016

Merged, thanks!

nijel added a commit that referenced this pull request Jul 29, 2016
Signed-off-by: Michal Čihař <michal@cihar.com>
rpv-tomsk added a commit to rpv-tomsk/phpmyadmin that referenced this pull request Aug 1, 2016
Issue is second part to phpmyadmin#12416

Signed-off-by: Pavel Rochnyack <pavel2000@ngs.ru>
@nijel nijel added this to the 4.6.4 milestone Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants