mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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
20 lines
481 B
PHP
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');
|
|
}
|