Skip to content

Commit

Permalink
Fixing #5555 - Aggregate Special Comment Use
Browse files Browse the repository at this point in the history
* Additional QA to cover HRULES and Special Comments
  • Loading branch information
TheWitness committed Nov 18, 2023
1 parent 5c88cdc commit 308835b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/api_aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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])) {
Expand Down Expand Up @@ -1478,10 +1477,6 @@ function aggregate_handle_ptile_type($member_graphs, $skipped_items, $local_grap

break;
}

if ($hrule_found && $comment_found) {
break;
}
}
}
}
Expand Down

0 comments on commit 308835b

Please sign in to comment.