From 1b5ecd7071f96555c62689878381eecb6e93c994 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 18 Feb 2021 16:26:47 +0100 Subject: [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. --- modules-available/statistics/pages/replace.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules-available/statistics/pages/replace.inc.php') 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)); } -- cgit v1.2.3-55-g7522