From 308835b7aabbc6a2b7c6a82d7d3c5d5629fa0895 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 407e16a5df..4e2a470617 100644 --- a/lib/api_aggregate.php +++ b/lib/api_aggregate.php @@ -1318,6 +1318,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 @@ -1332,8 +1333,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: @@ -1405,9 +1404,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']); if (isset($parts[1])) { @@ -1478,10 +1477,6 @@ function aggregate_handle_ptile_type($member_graphs, $skipped_items, $local_grap break; } - - if ($hrule_found && $comment_found) { - break; - } } } }