From f1d6744ea1d3f6cd061d646933f730fe053d5ea0 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 3 May 2011 21:21:42 +0000 Subject: [PATCH] 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 --- discovery.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/discovery.php b/discovery.php index 3108fed34..6ad31bcf7 100755 --- a/discovery.php +++ b/discovery.php @@ -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++; }