Skip to content

Commit

Permalink
Fixing #5462 - Preview Remove Orphans
Browse files Browse the repository at this point in the history
Package preview apparently making changes to Cacti Templates or there is a Caching issue
  • Loading branch information
TheWitness committed Aug 20, 2023
1 parent b31d198 commit d8a2a1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -162,6 +162,7 @@ Cacti CHANGELOG
-issue#5458: Unable to delete a Data Query when there are no Graphs using it
-issue#5459: There is no option to not duplicate Graph Template Data Query association when duplicating a Graph Template
-issue#5460: When duplicating a Data Template errors can appear in the Cacti log
-issue#5462: Package preview aparantely making changes to Cacti Templates or there is a Caching issue
-feature#5375: Add template for Fortinet firewall and Aruba Instant cluster
-feature#5393: Add template for SNMP printer
-feature#5418: Display device class before package import
Expand Down
6 changes: 3 additions & 3 deletions lib/import.php
Expand Up @@ -918,8 +918,8 @@ function xml_to_graph_template($hash, &$xml_array, &$hash_cache, $hash_version,
if (isset($orphaned_items) && cacti_sizeof($orphaned_items)) {
$orphan_text = array();

foreach ($orphaned_items as $item) {
if ($remove_orphans) {
foreach($orphaned_items as $item) {
if (!$preview_only && $remove_orphans) {
$orphan_text[] = 'Removed Orphaned Graph Items, Type: ' . $graph_item_types[$item['graph_type_id']] . ', Text Format: ' . $item['text_format'] . ', Value: ' . $item['value'];

db_execute_prepared('DELETE FROM graph_templates_item
Expand All @@ -936,7 +936,7 @@ function xml_to_graph_template($hash, &$xml_array, &$hash_cache, $hash_version,

$import_debug_info['orphans'] = $orphan_text;

if ($remove_orphans) {
if (!$preview_only && $remove_orphans) {
retemplate_graphs($graph_template_id);
}
}
Expand Down

0 comments on commit d8a2a1a

Please sign in to comment.