diff options
author | Steffen Ritter | 2022-08-22 14:55:33 +0200 |
---|---|---|
committer | Steffen Ritter | 2022-08-22 14:55:33 +0200 |
commit | 674ef0cb8de1872c4e2bce7f9ec0d6ca9a9eb3f7 (patch) | |
tree | 4bf60c7a025659e0c8751be66a8f767ea0c486cf /modules-available/statistics_reporting | |
parent | [statistics] Simplify SPD value interpretation now that I get it (diff) | |
download | slx-admin-674ef0cb8de1872c4e2bce7f9ec0d6ca9a9eb3f7.tar.gz slx-admin-674ef0cb8de1872c4e2bce7f9ec0d6ca9a9eb3f7.tar.xz slx-admin-674ef0cb8de1872c4e2bce7f9ec0d6ca9a9eb3f7.zip |
[statistics_reporting] Fallback for IP and hostname
The php '$_SERVER' variables are not populated when executed by
a cron job. As fallback use the server adress from ipxe-module.
Diffstat (limited to 'modules-available/statistics_reporting')
-rw-r--r-- | modules-available/statistics_reporting/inc/remotereport.inc.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules-available/statistics_reporting/inc/remotereport.inc.php b/modules-available/statistics_reporting/inc/remotereport.inc.php index e1f2d20e..fdd32f57 100644 --- a/modules-available/statistics_reporting/inc/remotereport.inc.php +++ b/modules-available/statistics_reporting/inc/remotereport.inc.php @@ -129,8 +129,8 @@ class RemoteReport $data['swapUsed'] = ($mem['SwapTotal'] - $mem['SwapFree']); } - $data['ip'] = $_SERVER['SERVER_ADDR']; - $data['hostname'] = strtolower(gethostbyaddr($_SERVER['SERVER_ADDR'])); + $data['ip'] = $_SERVER['SERVER_ADDR'] ?? Property::getServerIp(); + $data['hostname'] = strtolower(gethostbyaddr($_SERVER['SERVER_ADDR'] ?? Property::getServerIp())); $data['osID'] = $osInfo['ID']; $data['osVersionID'] = $osInfo['VERSION_ID']; |