From d2d7f27f58235db9ac428b9dd952e7b108f3c381 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 9 Sep 2016 18:16:46 +0200 Subject: [locations/statistics] Make machine counting more consistent --- modules-available/locations/inc/location.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules-available/locations/inc/location.inc.php') diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php index 81ee342f..bde07e61 100644 --- a/modules-available/locations/inc/location.inc.php +++ b/modules-available/locations/inc/location.inc.php @@ -140,6 +140,7 @@ class Location foreach ($tree as $node) { $output[(int)$node['locationid']] = array( 'locationid' => $node['locationid'], + 'parentlocationid' => $node['parentlocationid'], 'locationname' => $node['locationname'], 'locationpad' => str_repeat('--', $depth), 'isleaf' => empty($node['children']), @@ -287,7 +288,7 @@ class Location /** * @return array|bool assoc array mapping from locationid to subnets */ - public static function getSubnetsByLocation(&$overlapSelf, &$overlapOther) + public static function getSubnetsByLocation(&$overlapSelf, &$overlapOther, $recursive = true) { $locs = self::getLocationsAssoc(); $subnets = self::getSubnets(); @@ -307,6 +308,8 @@ class Location 'startaddr' => $subnet['startaddr'], 'endaddr' => $subnet['endaddr'] ); + if (!$recursive) + break; $lid = $locs[$lid]['parentlocationid']; } } -- cgit v1.2.3-55-g7522