Skip to content

Commit

Permalink
Fixing #5583 - Default Device Template Preset
Browse files Browse the repository at this point in the history
On install ensure Default Device is either Net-SNMP or Cisco Router or allow user to define during install
  • Loading branch information
TheWitness committed Nov 24, 2023
1 parent 33be800 commit 7d46198
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Cacti CHANGELOG
-issue#5572: RRD Checker timeouts to low
-issue#5573: Incorrect URL for editing graph template
-issue#5581: Due to previously never completed upgrade, future upgrades fail due to missing color table keys
-issue#5583: On install ensure Default Device is either Net-SNMP or Cisco Router or allow user to define during install
-issue#5585: Refix Issue #4649 using more appropriate method
-issue#5586: CSV export displays data shifted by rrd step interval
-issue#5589: When a graph has a real long cdef in graph debug mode, it forces an undesirable scroll
Expand Down
12 changes: 12 additions & 0 deletions lib/installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3027,13 +3027,25 @@ private function installTemplate() {
// Repair automation rules if broken
repair_automation();

$default_set = false;
if (read_config_option('default_template') != '') {
$default_set = true;
}

foreach($this->defaultAutomation as $item) {
$host_template_id = db_fetch_cell_prepared('SELECT id
FROM host_template
WHERE hash = ?',
array($item['hash']));

if (!empty($host_template_id)) {
if (!$default_set) {
log_install_always('', __('Setting the Default Device Template to \'%s\'', $item['name']));

set_config_option('default_template', $host_template_id);
$default_set = true;
}

log_install_always('', __('Mapping Automation Template for Device Template \'%s\'', $item['name']));

$exists = db_fetch_cell_prepared('SELECT host_template
Expand Down

0 comments on commit 7d46198

Please sign in to comment.