wrap device discovery in discover_device(). this will stop us having to clear variables so much.

git-svn-id: http://www.observium.org/svn/observer/trunk@2232 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-03 21:21:42 +00:00
parent b11ad816aa
commit f1d6744ea1

View File

@@ -148,6 +148,14 @@ $discovered_devices = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC");
while ($device = mysql_fetch_assoc($device_query))
{
discover_device($device, $options);
}
function discover_device($device, $options)
{
global $config;
$device_start = utime(); // Start counting device poll time
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
@@ -201,7 +209,9 @@ while ($device = mysql_fetch_assoc($device_query))
$update_result = mysql_query($update_query);
echo("Discovered in $device_time seconds\n");
unset($cache); // Clear cache (unify all things here?)
global $discovered_devices;
echo("\n"); $discovered_devices++;
}