move and optimize away some sql queries, remove obsolete code

git-svn-id: http://www.observium.org/svn/observer/trunk@2638 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-10-03 13:40:37 +00:00
parent 95bc8e3eef
commit 16a0989316
7 changed files with 51 additions and 47 deletions

View File

@@ -1,8 +1,21 @@
<?php
foreach (dbFetchRows("SELECT * FROM `devices`") as $device)
{
if (get_dev_attrib($device,'override_sysLocation_bool'))
{
$device['real_location'] = $device['location'];
$device['location'] = get_dev_attrib($device,'override_sysLocation_string');
}
$devices['count']++;
$cache['devices']['hostname'][$device['hostname']] = $device['device_id'];
$cache['devices']['id'][$device['device_id']] = $device;
}
if($_SESSION['userlevel'] >= 5)
{
$devices['count'] = dbFetchCell("SELECT COUNT(*) FROM devices");
$devices['up'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE status = '1' AND `ignore` = '0'");
$devices['down'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE status = '0' AND `ignore` = '0'");
$devices['ignored'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE `ignore` = '1'");