Files
librenms-librenms/includes/discovery/os.inc.php
Tony Murray 484f39cd70 Populate device icon in the database
The icon field was originally set up as an override for the display option but the only way to set it currently is directly in the DB afaik.
Populate the icon field during discovery, this should move a little execution from page display time to discovery time.
v2
2016-02-23 23:44:51 -06:00

20 lines
481 B
PHP

<?php
echo 'OS: ';
// MYSQL Check - FIXME
// 1 UPDATE
$os = getHostOS($device);
if ($os != $device['os'] || empty($device['icon'])) {
$device['os'] = $os;
// update icon
$icon = getImageName($device, false);
$device['icon'] = $icon;
$sql = dbUpdate(array('os' => $os, 'icon' => $icon), 'devices', 'device_id=?', array($device['device_id']));
echo "Changed OS! : $os\n";
log_event('Device OS changed '.$device['os']." => $os", $device, 'system');
}