mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 16:08:55 +02:00
Generalise arp discovery cache; move to common
This commit is contained in:
+22
-3
@@ -800,6 +800,28 @@ function enable_graphs($device, &$graph_enable)
|
||||
enable_os_graphs($device['os'], $graph_enable);
|
||||
}
|
||||
|
||||
//
|
||||
// maintain a simple cache of objects
|
||||
//
|
||||
|
||||
function object_add_cache($section, $obj)
|
||||
{
|
||||
global $object_cache;
|
||||
$object_cache[$section][$obj] = true;
|
||||
}
|
||||
|
||||
|
||||
function object_is_cached($section, $obj)
|
||||
{
|
||||
global $object_cache;
|
||||
if (array_key_exists($obj, $object_cache)) {
|
||||
return $object_cache[$obj];
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if config allows us to ping this device
|
||||
* $attribs contains an array of all of this devices
|
||||
@@ -812,9 +834,6 @@ function can_ping_device($attribs) {
|
||||
if ($config['icmp_check'] === true && $attribs['override_icmp_disable'] != "true") {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
} // end can_ping_device
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user