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:
Tony Murray
2019-03-01 23:06:01 -06:00
committed by GitHub
parent 7c4a0c7244
commit e677d4b63e
10 changed files with 46 additions and 45 deletions

View File

@@ -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')