mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix some ErrorExceptions (#14241)
* Fix some ErrorExceptions * Use Config::get default value Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -378,7 +378,9 @@ if ($options['f'] === 'mac_oui') {
|
||||
|
||||
if ($options['f'] === 'refresh_os_cache') {
|
||||
echo 'Clearing OS cache' . PHP_EOL;
|
||||
unlink(Config::get('install_dir') . '/cache/os_defs.cache');
|
||||
if (is_file(Config::get('install_dir') . '/cache/os_defs.cache')) {
|
||||
unlink(Config::get('install_dir') . '/cache/os_defs.cache');
|
||||
}
|
||||
}
|
||||
|
||||
if ($options['f'] === 'recalculate_device_dependencies') {
|
||||
|
@@ -127,7 +127,7 @@ if (Config::get('enable_bgp')) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($j_afisafi[$j_peerIndexes[$peer['ip']]] as $afisafi) {
|
||||
foreach ($j_afisafi[$j_peerIndexes[$peer['ip']]] ?? [] as $afisafi) {
|
||||
[$afi,$safi] = explode('.', $afisafi);
|
||||
$afi = $afis[$afi];
|
||||
$safi = $safis[$safi];
|
||||
|
@@ -1268,7 +1268,7 @@ function cache_peeringdb()
|
||||
$json_data = $get->body();
|
||||
$data = json_decode($json_data);
|
||||
$ixs = $data->{'data'}[0]->{'netixlan_set'};
|
||||
foreach ($ixs as $ix) {
|
||||
foreach ($ixs ?? [] as $ix) {
|
||||
$ixid = $ix->{'ix_id'};
|
||||
$tmp_ix = dbFetchRow('SELECT * FROM `pdb_ix` WHERE `ix_id` = ? AND asn = ?', [$ixid, $asn]);
|
||||
if ($tmp_ix) {
|
||||
|
@@ -74,7 +74,7 @@ if ($_GET['previous']) {
|
||||
|
||||
$rrd_options .= " COMMENT:'\\n'";
|
||||
|
||||
foreach ($rrd_list as $rrd) {
|
||||
foreach ($rrd_list ?? [] as $rrd) {
|
||||
if (! Config::get("graph_colours.$colours_in.$iter") || ! Config::get("graph_colours.$colours_out.$iter")) {
|
||||
$iter = 0;
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ if (count($drives)) {
|
||||
$skipdrive = 0;
|
||||
|
||||
if ($device['os'] == 'junos') {
|
||||
foreach (\LibreNMS\Config::get('ignore_junos_os_drives') as $jdrive) {
|
||||
foreach (\LibreNMS\Config::get('ignore_junos_os_drives', []) as $jdrive) {
|
||||
if (preg_match($jdrive, $drive['storage_descr'])) {
|
||||
$skipdrive = 1;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ if (count($drives)) {
|
||||
}
|
||||
|
||||
if ($device['os'] == 'freebsd') {
|
||||
foreach (\LibreNMS\Config::get('ignore_bsd_os_drives') as $jdrive) {
|
||||
foreach (\LibreNMS\Config::get('ignore_bsd_os_drives', []) as $jdrive) {
|
||||
if (preg_match($jdrive, $drive['storage_descr'])) {
|
||||
$skipdrive = 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user