fixed errors

This commit is contained in:
Daniel Barbero Martin 2019-11-14 08:53:45 +01:00
parent 42fc81a408
commit 86162b4c66
1 changed files with 50 additions and 28 deletions

View File

@ -1280,10 +1280,8 @@ class Diagnostics extends Wizard
{
global $config;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return [];
}
$result = [];
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
$totalServerThreads = shell_exec(
'ps -T aux | grep pandora_server | grep -v grep | wc -l'
);
@ -1311,6 +1309,30 @@ class Diagnostics extends Wizard
],
],
];
}
include_once $config['homedir'].'/include/functions_servers.php';
$sql = 'SELECT `name`, server_type, threads FROM tserver';
$servers = db_get_all_rows_sql($sql);
if (isset($servers) === true && is_array($servers) === true) {
$sum_threads = 0;
foreach ($servers as $key => $value) {
$result['data']['threads_server_'.$value['server_type']] = [
'name' => __('Threads').' '.\servers_get_server_string_name(
$value['server_type']
),
'value' => $value['threads'],
];
$sum_threads += $value['threads'];
}
$result['data']['total_threads'] = [
'name' => __('Total threads'),
'value' => $sum_threads,
];
}
return json_encode($result);
}