Skip to content

Commit

Permalink
Merge pull request #14429 from laps15/bugfix
Browse files Browse the repository at this point in the history
Fix server databases statistics
  • Loading branch information
MauricioFauth committed Jun 26, 2018
2 parents a2c4827 + 05cff7e commit 3ea6fec
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,17 @@ private function _getHtmlForDatabases(array $replication_types)
$first_database = reset($this->_databases);
// table col order
$column_order = $this->_getColumnOrder();
$dbColumnOrders = [];

// calculate aggregate stats to display in footer
foreach ($this->_databases as $current) {
$dbColumnOrders[$current['SCHEMA_NAME']] = $this->_getColumnOrder();
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $current)
&& is_numeric($stat['footer'])
) {
$column_order[$stat_name]['footer'] += $current[$stat_name];
$dbColumnOrders[$current['SCHEMA_NAME']][$stat_name]['footer'] = $current[$stat_name];
}
}
}
Expand Down Expand Up @@ -320,7 +323,7 @@ private function _getHtmlForDatabases(array $replication_types)
'allow_user_drop_database' => $GLOBALS['cfg']['AllowUserDropDatabase'],
]);

$html .= $this->_getHtmlForTableBody($column_order, $replication_types);
$html .= $this->_getHtmlForTableBody($dbColumnOrders, $replication_types);

$html .= $this->template->render('server/databases/databases_footer', [
'column_order' => $column_order,
Expand Down Expand Up @@ -396,7 +399,7 @@ private function _getColumnOrder()
*
* @return string
*/
private function _getHtmlForTableBody(array $column_order, array $replication_types)
private function _getHtmlForTableBody(array $dbColumnOrders, array $replication_types)
{
$html = '<tbody>' . "\n";

Expand All @@ -408,7 +411,7 @@ private function _getHtmlForTableBody(array $column_order, array $replication_ty

$generated_html = $this->_buildHtmlForDb(
$current,
$column_order,
$dbColumnOrders[$current['SCHEMA_NAME']],
$replication_types,
$GLOBALS['replication_info'],
$tr_class
Expand Down

0 comments on commit 3ea6fec

Please sign in to comment.