add web server stat

This commit is contained in:
Jean-Christian Denis 2023-08-27 18:19:40 +02:00
parent 80b0032e2b
commit 4d5066d118
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -109,6 +109,31 @@ class Utils
return $modules;
}
/**
* Get server software and version.
*
* @return array<string,string> The server info
*/
public static function getServer(): array
{
$res = [
'name' => 'undefined',
'version' => 'undefined',
];
if (!empty($_SERVER['SERVER_SOFTWARE'])) {
$exp = explode('/', $_SERVER['SERVER_SOFTWARE']);
if (count($exp) == 2) {
$res = [
'name' => $exp[0],
'version' => $exp[1],
];
}
}
return $res;
}
/**
* Get report contents.
*
@ -329,7 +354,8 @@ class Utils
'core' => [
'version' => DC_VERSION,
],
'php' => [
'server' => self::getServer(),
'php' => [
'sapi' => php_sapi_name() ?: 'php',
'version' => phpversion(),
],