Skip to content

Commit

Permalink
Merge pull request #3230 from Rosiak/issue-3229
Browse files Browse the repository at this point in the history
check_valid_sensors - Correction
  • Loading branch information
laf committed Mar 13, 2016
2 parents f80a4a3 + f1bb532 commit f32b768
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions includes/discovery/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,14 @@ function check_valid_sensors($device, $class, $valid, $poller_type = 'snmp') {
foreach ($entries as $entry) {
$index = $entry['sensor_index'];
$type = $entry['sensor_type'];
$class = $entry['sensor_class'];
d_echo($index . ' -> ' . $type . "\n");

if (!$valid[$class][$type][$index]) {
echo '-';
if ($class == 'state') {
dbDelete('sensors_to_state_indexes', '`sensor_id` = ?', array($entry['sensor_id']));
}
dbDelete('sensors', '`sensor_id` = ?', array($entry['sensor_id']));
log_event('Sensor Deleted: ' . $entry['sensor_class'] . ' ' . $entry['sensor_type'] . ' ' . $entry['sensor_index'] . ' ' . $entry['sensor_descr'], $device, 'sensor', $sensor_id);
}
Expand Down

0 comments on commit f32b768

Please sign in to comment.