From 674ef0cb8de1872c4e2bce7f9ec0d6ca9a9eb3f7 Mon Sep 17 00:00:00 2001 From: Steffen Ritter Date: Mon, 22 Aug 2022 14:55:33 +0200 Subject: [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. --- modules-available/statistics_reporting/inc/remotereport.inc.php | 4 ++-- 1 file 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']; -- cgit v1.2.3-55-g7522