diff options
author | Simon Rettberg | 2019-02-15 17:08:27 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-02-15 17:08:27 +0100 |
commit | 7863dcad82b760de0877005a08c5af28d43a6c93 (patch) | |
tree | 1deaa26121f3d6443fb5f0f3b20eb60f0f9c025d | |
parent | Merge branch 'ipxe' (diff) | |
download | slx-admin-7863dcad82b760de0877005a08c5af28d43a6c93.tar.gz slx-admin-7863dcad82b760de0877005a08c5af28d43a6c93.tar.xz slx-admin-7863dcad82b760de0877005a08c5af28d43a6c93.zip |
[dnbd3] Fix recursive client counting
-rw-r--r-- | modules-available/dnbd3/page.inc.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules-available/dnbd3/page.inc.php b/modules-available/dnbd3/page.inc.php index 84007797..03c7e6cd 100644 --- a/modules-available/dnbd3/page.inc.php +++ b/modules-available/dnbd3/page.inc.php @@ -332,16 +332,18 @@ class Page_Dnbd3 extends Page $locCount[0] = array( 'locationname' => '/', 'depth' => 0, - 'recCount' => 0, ); foreach ($locCount as &$loc) { + $loc['clientCount'] = 0; $loc['recCount'] = 0; } $showLocs = false; while ($row = $res->fetch(PDO::FETCH_ASSOC)) { settype($row['locationid'], 'int'); + trigger_error('Bla: ' . $row['locationid'] . ', blu: ' . isset($locCount[$row['locationid']])); $loc =& $locCount[$row['locationid']]; $loc['clientCount'] = $row['cnt']; + trigger_error('Setting ' . $row['locationid'] . ' to ' . $row['cnt'] . ', rec was ' . $loc['recCount']); $loc['recCount'] += $row['cnt']; if ($row['locationid'] !== 0) { $showLocs = true; @@ -350,9 +352,11 @@ class Page_Dnbd3 extends Page if (isset($loc['parents'])) { foreach ($loc['parents'] as $p) { $locCount[$p]['keep'] = true; + trigger_error('[' . $p . '] Adding ' . $row['cnt'] . ' to ' . $locCount[$p]['recCount']); $locCount[$p]['recCount'] += $row['cnt']; } } + $locCount[0]['recCount'] += $row['cnt']; } if ($showLocs) { $stats['loclist'] = array_values(array_filter($locCount, function ($v) { return isset($v['keep']); })); |