fix visual errors not working servers pandora_enterprise#12178

This commit is contained in:
daniel 2024-02-12 10:34:43 +01:00
parent 639fbcc807
commit 45ffdb1cc5
3 changed files with 31 additions and 13 deletions

View File

@ -54,7 +54,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
// ======= Servers List ===============================================
if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) {
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
$servers['all'] = (int) count((servers_get_info() ?? []));
if ($servers['all'] != 0) {
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);

View File

@ -1510,17 +1510,35 @@ class ConsoleSupervisor
{
global $config;
$types_sql = '';
if (is_metaconsole() === true && isset($config['ndbh']) === false) {
$types_sql = sprintf(
' AND (
`server_type` = %d OR
`server_type` = %d OR
`server_type` = %d OR
`server_type` = %d
)',
SERVER_TYPE_AUTOPROVISION,
SERVER_TYPE_EVENT,
SERVER_TYPE_MIGRATION,
SERVER_TYPE_PREDICTION
);
}
$servers = db_get_all_rows_sql(
'SELECT
id_server,
name,
server_type,
server_keepalive,
status,
unix_timestamp() - unix_timestamp(keepalive) as downtime
FROM tserver
WHERE
unix_timestamp() - unix_timestamp(keepalive) > server_keepalive'
sprintf(
'SELECT id_server,
`name`,
server_type,
server_keepalive,
`status`,
unix_timestamp() - unix_timestamp(keepalive) as downtime
FROM tserver
WHERE unix_timestamp() - unix_timestamp(keepalive) > server_keepalive
%s',
$types_sql
)
);
if ($servers === false) {

View File

@ -12546,7 +12546,7 @@ function reporting_get_stats_indicators($data, $width=280, $height=20, $html=tru
$table_ind = html_get_predefined_table();
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
$servers['all'] = (int) count((servers_get_info() ?? []));
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);
if ($servers['all'] == 0) {
@ -12607,7 +12607,7 @@ function reporting_get_stats_indicators_mobile($data, $width=280, $height=20, $h
$table_ind = html_get_predefined_table();
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
$servers['all'] = (int) count((servers_get_info() ?? []));
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);
if ($servers['all'] == 0) {