summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages/replace.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2021-02-18 16:26:47 +0100
committerSimon Rettberg2021-02-18 16:26:47 +0100
commit1b5ecd7071f96555c62689878381eecb6e93c994 (patch)
treecb30a40fccd767342d5a72c543a9d7f0f6c9f295 /modules-available/statistics/pages/replace.inc.php
parent[statistics] Store ID45 live stats (diff)
downloadslx-admin-1b5ecd7071f96555c62689878381eecb6e93c994.tar.gz
slx-admin-1b5ecd7071f96555c62689878381eecb6e93c994.tar.xz
slx-admin-1b5ecd7071f96555c62689878381eecb6e93c994.zip
[statistics] Add soft-delete feature: Resets a client's IP and location
Soft-deleting a client doesn't remove its entire data and usage history from the database, but just resets IP and location, so it doesn't appear in its former location anymore. In case a client is removed from a room, this declutters the client statistics. Once the client boots again, location and and IP address will be updated again.
Diffstat (limited to 'modules-available/statistics/pages/replace.inc.php')
-rw-r--r--modules-available/statistics/pages/replace.inc.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules-available/statistics/pages/replace.inc.php b/modules-available/statistics/pages/replace.inc.php
index ae9c6108..9c16aed7 100644
--- a/modules-available/statistics/pages/replace.inc.php
+++ b/modules-available/statistics/pages/replace.inc.php
@@ -69,14 +69,17 @@ class SubPage
// Finalize by updating machine table
foreach ($list as $entry) {
unset($entry['datelimit']);
- Database::exec('UPDATE machine old, machine new SET
+ Database::exec("UPDATE machine old, machine new SET
new.fixedlocationid = old.fixedlocationid,
new.position = old.position,
old.position = NULL,
+ old.subnetlocationid = NULL,
+ old.fixedlocationid = NULL,
new.notes = old.notes,
old.notes = NULL,
- old.lastseen = new.firstseen
- WHERE old.machineuuid = :old AND new.machineuuid = :new', $entry);
+ old.lastseen = new.firstseen,
+ old.clientip = '0.0.0.0'
+ WHERE old.machineuuid = :old AND new.machineuuid = :new", $entry);
}
Message::addSuccess('x-machines-replaced', count($list));
}