diff options
Diffstat (limited to 'modules-available/statistics/baseconfig/getconfig.inc.php')
-rw-r--r-- | modules-available/statistics/baseconfig/getconfig.inc.php | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/modules-available/statistics/baseconfig/getconfig.inc.php b/modules-available/statistics/baseconfig/getconfig.inc.php index 7bf25d5d..f90cd49d 100644 --- a/modules-available/statistics/baseconfig/getconfig.inc.php +++ b/modules-available/statistics/baseconfig/getconfig.inc.php @@ -1,14 +1,17 @@ <?php +/** @var ?string $uuid */ +/** @var ?string $ip */ + // Location handling: figure out location if (Request::any('force', 0, 'int') === 1 && Request::any('module', false, 'string') === 'statistics') { // Force location for testing, but require logged in admin if (User::load()) { - $uuid = Request::any('value', '', 'string'); + $uuid = Request::any('value', null, 'string'); } } -if (!$uuid) // Required at this point, bail out if not given +if ($uuid === null) // Required at this point, bail out if not given return; // Query machine specific settings @@ -17,20 +20,22 @@ foreach ($res as $row) { ConfigHolder::add($row['setting'], $row['value'], 500); } +if ($ip !== null) { // Statistics about booted system -ConfigHolder::addPostHook(function() use ($ip, $uuid) { - $type = Request::get('type', 'default', 'string'); - // System - if ($type !== 'default') { - Database::exec("INSERT INTO statistic (dateline, typeid, clientip, machineuuid, username, data) + ConfigHolder::addPostHook(function () use ($ip, $uuid) { + $type = Request::get('type', 'default', 'string'); + // System + if ($type !== 'default') { + Database::exec("INSERT INTO statistic (dateline, typeid, clientip, machineuuid, username, data) VALUES (UNIX_TIMESTAMP(), :type, :ip, :uuid, '', :data)", - ['type' => 'boot-system', 'ip' => $ip, 'uuid' => $uuid, 'data' => $type]); - } - // Runmode - $mode = ConfigHolder::get('SLX_RUNMODE_MODULE'); - if (!empty($mode)) { - Database::exec("INSERT INTO statistic (dateline, typeid, clientip, machineuuid, username, data) + ['type' => 'boot-system', 'ip' => $ip, 'uuid' => $uuid, 'data' => $type]); + } + // Runmode + $mode = ConfigHolder::get('SLX_RUNMODE_MODULE'); + if (!empty($mode)) { + Database::exec("INSERT INTO statistic (dateline, typeid, clientip, machineuuid, username, data) VALUES (UNIX_TIMESTAMP(), :type, :ip, :uuid, '', :data)", - ['type' => 'boot-runmode', 'ip' => $ip, 'uuid' => $uuid, 'data' => $mode]); - } -}); + ['type' => 'boot-runmode', 'ip' => $ip, 'uuid' => $uuid, 'data' => $mode]); + } + }); +}
\ No newline at end of file |