Skip to content

Commit

Permalink
QA: Fixing #5726 - Poller Cache not updating
Browse files Browse the repository at this point in the history
Poller cache is not updating when changing hostname
  • Loading branch information
TheWitness committed Apr 14, 2024
1 parent 477ab30 commit 5362720
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/utility.php
Expand Up @@ -700,7 +700,7 @@ function push_out_host($host_id, $local_data_id = 0, $data_template_id = 0) {
$sql_where = '';

/* setup the sql where, and if using a host, get it's host information */
if ($host_id != 0) {
if ($host_id > 0) {
/* get all information about this host so we can write it to the data source */
$hosts[$host_id] = db_fetch_row_prepared('SELECT ' . SQL_NO_CACHE . ' id AS host_id, host.*
FROM host WHERE id = ?',
Expand All @@ -710,12 +710,12 @@ function push_out_host($host_id, $local_data_id = 0, $data_template_id = 0) {
}

/* sql WHERE for local_data_id */
if ($local_data_id != 0) {
if ($local_data_id > 0) {
$sql_where .= ' AND dl.id = ' . $local_data_id;
}

/* sql WHERE for data_template_id */
if ($data_template_id != 0) {
if ($data_template_id > 0) {
$sql_where .= ' AND dtd.data_template_id = ' . $data_template_id;
}

Expand Down Expand Up @@ -775,7 +775,7 @@ function push_out_host($host_id, $local_data_id = 0, $data_template_id = 0) {

// Only override if the template value is null as this point
if (preg_match('/^' . VALID_HOST_FIELDS . '$/i', $template_field['type_code']) &&
$template_field['t_value'] != 'on' && $template_field['value'] == '') {
(($template_field['t_value'] != 'on' && $template_field['value'] == '') || $data_source['snmp_query_id'] == 0)) {
// It's a valid host type-code
$update = true;

Expand Down

0 comments on commit 5362720

Please sign in to comment.