fix: fix marking invalid ports as deleted in discovery (#6665)

There seem to be other issues in this file, such as $ports_l is never defined...
This commit is contained in:
Tony Murray 2017-05-17 16:25:47 -05:00 committed by Neil Lathwood
parent 390dd0bece
commit 8d1b7d5493

View File

@ -65,11 +65,11 @@ foreach ($port_stats as $ifIndex => $port) {
// We've seen it. Remove it from the cache.
unset($ports_l[$ifIndex]);
} // Port vanished (mark as deleted)
else {
} else {
// Port vanished (mark as deleted)
if (is_array($ports_db[$port_id])) {
if ($ports_db[$port_id]['deleted'] != '1') {
dbUpdate(array('deleted' => '1'), 'ports', "`port_id` = ?, `ifName` => '?', `ifAlias` => '?', `ifDescr` => '?'", array($port_id, $ifName, $ifAlias, $ifDescr));
dbUpdate(array('deleted' => '1'), 'ports', '`port_id` = ?', array($port_id));
$ports_db[$port_id]['deleted'] = '1';
echo '-';
}