From 74e4f430e2149f73090460b327ab2eb24df7e110 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Sat, 18 Nov 2023 12:15:11 -0500 Subject: [PATCH] Fixing #5555 - Aggregate Special Comment Use * Additional QA to cover HRULES and Special Comments --- lib/api_aggregate.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/api_aggregate.php b/lib/api_aggregate.php index 79c5f7e426..eeeb6df9bf 100644 --- a/lib/api_aggregate.php +++ b/lib/api_aggregate.php @@ -1344,6 +1344,7 @@ function aggregate_create_update(&$local_graph_id, $member_graphs, $attribs) { function aggregate_handle_ptile_type($member_graphs, $skipped_items, $local_graph_id, $_total, $_total_type) { static $special_comments = null; + static $special_hrules = null; $comments_hrules = db_fetch_assoc('SELECT * FROM graph_templates_item @@ -1358,8 +1359,6 @@ function aggregate_handle_ptile_type($member_graphs, $skipped_items, $local_grap array($local_graph_id)); if (cacti_sizeof($comments_hrules)) { - $hrule_found = false; - foreach ($comments_hrules as $item) { switch($item['graph_type_id']) { case GRAPH_ITEM_TYPE_COMMENT: @@ -1437,9 +1436,9 @@ function aggregate_handle_ptile_type($member_graphs, $skipped_items, $local_grap break; case GRAPH_ITEM_TYPE_HRULE: - if (!$hrule_found) { + if (!isset($special_hrules[$item['value']])) { if (preg_match('/(:bits:|:bytes:)/', $item['value'])) { - $hrule_found = true; + $special_hrules[$item['value']] = true; $parts = explode('|', $item['value']); @@ -1517,10 +1516,6 @@ function aggregate_handle_ptile_type($member_graphs, $skipped_items, $local_grap break; } - - if ($hrule_found && $comment_found) { - break; - } } } }