mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix fanspeeds if no fans in database
git-svn-id: http://www.observium.org/svn/observer/trunk@816 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -95,23 +95,24 @@ if ($device['os'] == "linux")
|
||||
## Delete removed sensors
|
||||
|
||||
$sql = "SELECT * FROM fanspeed AS V, devices AS D WHERE V.fan_host = D.device_id AND D.device_id = '".$device['device_id']."'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while ($sensor = mysql_fetch_array($query))
|
||||
if ($query = mysql_query($sql))
|
||||
{
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
while ($i < count($fan_exists) && !$exists)
|
||||
while ($sensor = mysql_fetch_array($query))
|
||||
{
|
||||
$thisfan = $sensor['fan_host'] . " " . $sensor['fan_oid'];
|
||||
if ($fan_exists[$i] == $thisfan) { $exists = 1; }
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$exists)
|
||||
{
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM fanspeed WHERE fan_id = '" . $sensor['fan_id'] . "'");
|
||||
unset($exists);
|
||||
$i = 0;
|
||||
while ($i < count($fan_exists) && !$exists)
|
||||
{
|
||||
$thisfan = $sensor['fan_host'] . " " . $sensor['fan_oid'];
|
||||
if ($fan_exists[$i] == $thisfan) { $exists = 1; }
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (!$exists)
|
||||
{
|
||||
echo("-");
|
||||
mysql_query("DELETE FROM fanspeed WHERE fan_id = '" . $sensor['fan_id'] . "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user