librenms/includes/discovery/entity-physical.inc.php
Tony Murray b18c41b1a9 refactor: Use the Config class includes/discovery (#7299)
* refactor: use the Config class includes/discovery

* fix issue with $config variable not accessible in include-dir.inc.php

* improved whitespace

* Tidy up discovery_by_ip
2017-09-11 21:26:41 +01:00

31 lines
813 B
PHP

<?php
use LibreNMS\Config;
if (Config::get('enable_inventory')) {
// Legacy entPhysical - junos/timos/cisco
include 'includes/discovery/entity-physical/entity-physical.inc.php';
// Cisco CIMC
if ($device['os'] == 'cimc') {
include 'includes/discovery/entity-physical/cimc.inc.php';
}
// Delete any entries that have not bee accounted for.
$sql = 'SELECT * FROM `entPhysical` WHERE `device_id` = ?';
foreach (dbFetchRows($sql, array($device['device_id'])) as $test) {
$id = $test['entPhysicalIndex'];
if (!$valid[$id]) {
echo '-';
dbDelete('entPhysical', 'entPhysical_id = ?', array ($test['entPhysical_id']));
}
}
unset(
$sql,
$test,
$valid
);
} else {
echo 'Disabled!';
}//end if