From a0e43d9fb99f65c0f6c9357d9fbaccab36deec5a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 11 Jan 2017 12:19:20 +0100 Subject: [statistics/locations] Update/set subnetlocationid field in DB if the DB has been updated --- modules-available/statistics/install.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules-available/statistics/install.inc.php') diff --git a/modules-available/statistics/install.inc.php b/modules-available/statistics/install.inc.php index 0729d676..7baf046e 100644 --- a/modules-available/statistics/install.inc.php +++ b/modules-available/statistics/install.inc.php @@ -155,6 +155,14 @@ if ($addTrigger) { if ($ret === false) { finalResponse(UPDATE_FAILED, 'Adding locationid trigger to machine failed: ' . Database::lastError()); } + // This might be an update - calculate all subnetlocationid values (if location module is installed yet) + if (Module::isAvailable('locations')) { + if (tableExists('subnet')) { + AutoLocation::rebuildAll(); + } else { + finalResponse(UPDATE_RETRY, 'Locations module not installed yet, retry later'); + } + } } // Create response -- cgit v1.2.3-55-g7522