mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix incorrect icon sometimes (#9887)
* Fix icon finding Also fix os suggest not loading all OS. * Fix os that would have missing icon under the new code (and one under the old code) * forgot icon
This commit is contained in:
@@ -409,39 +409,7 @@ function getImageTitle($device)
|
||||
|
||||
function getImageName($device, $use_database = true, $dir = 'images/os/')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$os = strtolower($device['os']);
|
||||
|
||||
// fetch from the database
|
||||
if ($use_database && is_file($config['html_dir'] . "/$dir" . $device['icon'])) {
|
||||
return $device['icon'];
|
||||
}
|
||||
|
||||
// linux specific handling, distro icons
|
||||
$distro = null;
|
||||
if ($os == "linux") {
|
||||
$features = strtolower(trim($device['features']));
|
||||
list($distro) = explode(" ", $features);
|
||||
}
|
||||
|
||||
$possibilities = array(
|
||||
$distro,
|
||||
$config['os'][$os]['icon'],
|
||||
$os,
|
||||
);
|
||||
|
||||
foreach ($possibilities as $basename) {
|
||||
foreach (array('.svg', '.png') as $ext) {
|
||||
$name = $basename . $ext;
|
||||
if (is_file($config['html_dir'] . "/$dir" . $name)) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fallback to the generic icon
|
||||
return 'generic.svg';
|
||||
return \LibreNMS\Util\Url::findOsImage($device['os'], $device['features'], $use_database ? $device['icon'] : null, $dir);
|
||||
}
|
||||
|
||||
function renamehost($id, $new, $source = 'console')
|
||||
|
Reference in New Issue
Block a user