diff --git a/apps/controllers/AdminController.php b/apps/controllers/AdminController.php index 8bdef2e..850842e 100644 --- a/apps/controllers/AdminController.php +++ b/apps/controllers/AdminController.php @@ -116,10 +116,6 @@ private function infoRedis() private function infoMysql() { $res = app()->pdo->createCommand('SHOW GLOBAL STATUS')->queryAll(); - $res = array_map(function ($s) { - $s['Variable_name'] = str_replace('_', ' ', $s['Variable_name']); - return $s; - }, $res); $serverStatus = array_column($res, 'Value', 'Variable_name'); $startAt = app()->pdo->createCommand('SELECT UNIX_TIMESTAMP() - :uptime')->bindParams([ 'uptime' => $serverStatus['Uptime'] @@ -127,7 +123,7 @@ private function infoMysql() $queryStats = []; $tmp_array = $serverStatus; foreach ($tmp_array AS $name => $value) { - if (substr($name, 0, 4) == 'Com ') { + if (substr($name, 0, 4) == 'Com_') { $queryStats[substr($name, 4)] = $value; unset($serverStatus[$name]); } diff --git a/apps/views/admin/mysql_status.html.twig b/apps/views/admin/mysql_status.html.twig index a2c2256..92e6ba2 100644 --- a/apps/views/admin/mysql_status.html.twig +++ b/apps/views/admin/mysql_status.html.twig @@ -26,18 +26,18 @@ Received - {{ serverStatus['Bytes received'] | format_bytes }} - {{ (serverStatus['Bytes received'] * 3600 / serverStatus['Uptime']) | format_bytes }} + {{ serverStatus['Bytes_received'] | format_bytes }} + {{ (serverStatus['Bytes_received'] * 3600 / serverStatus['Uptime']) | format_bytes }} Sent - {{ serverStatus['Bytes sent'] | format_bytes }} - {{ (serverStatus['Bytes sent'] * 3600 / serverStatus['Uptime']) | format_bytes }} + {{ serverStatus['Bytes_sent'] | format_bytes }} + {{ (serverStatus['Bytes_sent'] * 3600 / serverStatus['Uptime']) | format_bytes }} Total - {{ (serverStatus['Bytes received'] + serverStatus['Bytes sent']) | format_bytes }} - {{ ((serverStatus['Bytes sent'] + serverStatus['Bytes sent']) * 3600 / serverStatus['Uptime']) | format_bytes }} + {{ (serverStatus['Bytes_received'] + serverStatus['Bytes_sent']) | format_bytes }} + {{ ((serverStatus['Bytes_sent'] + serverStatus['Bytes_sent']) * 3600 / serverStatus['Uptime']) | format_bytes }} @@ -55,18 +55,18 @@ Failed Attempts - {{ serverStatus['Aborted connects'] | number_format(0,'.', ',') }} - {{ (serverStatus['Aborted connects'] * 3600 / serverStatus['Uptime']) | number_format(2,'.',',') }} + {{ serverStatus['Aborted_connects'] | number_format(0,'.', ',') }} + {{ (serverStatus['Aborted_connects'] * 3600 / serverStatus['Uptime']) | number_format(2,'.',',') }} - {% if serverStatus['Connections'] > 0 %}{{ (serverStatus['Aborted connects'] * 100 / serverStatus['Connections']) | number_format(2,'.',',') }} %{% else %}---{% endif %} + {% if serverStatus['Connections'] > 0 %}{{ (serverStatus['Aborted_connects'] * 100 / serverStatus['Connections']) | number_format(2,'.',',') }} %{% else %}---{% endif %} Aborted Clients - {{ serverStatus['Aborted clients'] | number_format(0,'.', ',') }} - {{ (serverStatus['Aborted clients'] * 3600 / serverStatus['Uptime']) | number_format(2,'.',',') }} + {{ serverStatus['Aborted_clients'] | number_format(0,'.', ',') }} + {{ (serverStatus['Aborted_clients'] * 3600 / serverStatus['Uptime']) | number_format(2,'.',',') }} - {% if serverStatus['Connections'] > 0 %}{{ (serverStatus['Aborted clients'] * 100 / serverStatus['Connections']) | number_format(2,'.',',') }} %{% else %}---{% endif %} + {% if serverStatus['Connections'] > 0 %}{{ (serverStatus['Aborted_clients'] * 100 / serverStatus['Connections']) | number_format(2,'.',',') }} %{% else %}---{% endif %} @@ -108,7 +108,7 @@ {% for key, value in rows %} - {{ key }} + {{ key|replace({'_':' '}) }} {{ value | number_format(0,'.',',') }} {{ (value * 3600 / serverStatus['Uptime']) | number_format(2,'.',',') }} {{ (value * 100 / (serverStatus['Questions'] - serverStatus['Connections'])) | number_format(2,'.',',') }} @@ -139,7 +139,7 @@ {% for key,value in serverStatus %} - {{ key }} + {{ key|replace({'_':' '}) }} {{ value }} {% endfor %}