From 77ac068eda471760fa93cc10a177dbefff322d76 Mon Sep 17 00:00:00 2001
From: Madhura Jayaratne
Date: Wed, 12 Aug 2015 16:38:36 +0530
Subject: [PATCH] Refactor server_status.lib.php
Signed-off-by: Madhura Jayaratne
---
libraries/server_status.lib.php | 77 ++++++++++++++++++---------------
1 file changed, 43 insertions(+), 34 deletions(-)
diff --git a/libraries/server_status.lib.php b/libraries/server_status.lib.php
index 611ac12291..824bdfe50d 100644
--- a/libraries/server_status.lib.php
+++ b/libraries/server_status.lib.php
@@ -30,6 +30,13 @@ function PMA_getHtmlForServerStatus($ServerStatusData)
//display the server state connection information
$retval .= PMA_getHtmlForServerStateConnections($ServerStatusData);
+ // display replication information
+ if ($GLOBALS['replication_info']['master']['status']
+ || $GLOBALS['replication_info']['slave']['status']
+ ) {
+ $retval .= PMA_getHtmlForReplicationInfo();
+ }
+
return $retval;
}
@@ -69,48 +76,50 @@ function PMA_getHtmlForServerStateGeneralInfo($ServerStatusData)
) . "\n";
$retval .= '
';
+ return $retval;
+}
+
+/**
+ * Returns HTML to display replication information
+ *
+ * @return string HTML on replication
+ */
+function PMA_getHtmlForReplicationInfo()
+{
+ $retval = '';
if ($GLOBALS['replication_info']['master']['status']
- || $GLOBALS['replication_info']['slave']['status']
+ && $GLOBALS['replication_info']['slave']['status']
) {
- $retval .= '
';
- if ($GLOBALS['replication_info']['master']['status']
- && $GLOBALS['replication_info']['slave']['status']
- ) {
- $retval .= __(
- 'This MySQL server works as master and '
- . 'slave in replication process.'
- );
- } elseif ($GLOBALS['replication_info']['master']['status']) {
- $retval .= __(
- 'This MySQL server works as master '
- . 'in replication process.'
- );
- } elseif ($GLOBALS['replication_info']['slave']['status']) {
- $retval .= __(
- 'This MySQL server works as slave '
- . 'in replication process.'
- );
- }
- $retval .= '
';
+ $retval .= __(
+ 'This MySQL server works as master and '
+ . 'slave in replication process.'
+ );
+ } elseif ($GLOBALS['replication_info']['master']['status']) {
+ $retval .= __(
+ 'This MySQL server works as master '
+ . 'in replication process.'
+ );
+ } elseif ($GLOBALS['replication_info']['slave']['status']) {
+ $retval .= __(
+ 'This MySQL server works as slave '
+ . 'in replication process.'
+ );
}
+ $retval .= '';
/*
* if the server works as master or slave in replication process,
* display useful information
*/
- if ($GLOBALS['replication_info']['master']['status']
- || $GLOBALS['replication_info']['slave']['status']
- ) {
- $retval .= '
';
- $retval .= '';
- foreach ($GLOBALS['replication_types'] as $type) {
- if (isset($GLOBALS['replication_info'][$type]['status'])
- && $GLOBALS['replication_info'][$type]['status']
- ) {
- $retval .= PMA_getHtmlForReplicationStatusTable($type);
- }
+ $retval .= '
';
+ $retval .= '';
+ foreach ($GLOBALS['replication_types'] as $type) {
+ if (isset($GLOBALS['replication_info'][$type]['status'])
+ && $GLOBALS['replication_info'][$type]['status']
+ ) {
+ $retval .= PMA_getHtmlForReplicationStatusTable($type);
}
}