mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix temp discovery if no temps in database
git-svn-id: http://www.observium.org/svn/observer/trunk@818 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -267,23 +267,25 @@ if ($device['os'] == "ios")
|
|||||||
## Delete removed sensors
|
## Delete removed sensors
|
||||||
|
|
||||||
$sql = "SELECT * FROM temperature AS T, devices AS D WHERE T.temp_host = D.device_id AND D.device_id = '".$device['device_id']."'";
|
$sql = "SELECT * FROM temperature AS T, devices AS D WHERE T.temp_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);
|
while ($sensor = mysql_fetch_array($query))
|
||||||
$i = 0;
|
|
||||||
while ($i < count($temp_exists) && !$exists)
|
|
||||||
{
|
{
|
||||||
$thistemp = $sensor['temp_host'] . " " . $sensor['temp_oid'];
|
unset($exists);
|
||||||
if ($temp_exists[$i] == $thistemp) { $exists = 1; }
|
$i = 0;
|
||||||
$i++;
|
while ($i < count($temp_exists) && !$exists)
|
||||||
}
|
{
|
||||||
|
$thistemp = $sensor['temp_host'] . " " . $sensor['temp_oid'];
|
||||||
|
if ($temp_exists[$i] == $thistemp) { $exists = 1; }
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$exists)
|
if (!$exists)
|
||||||
{
|
{
|
||||||
echo("-");
|
echo("-");
|
||||||
mysql_query("DELETE FROM temperature WHERE temp_id = '" . $sensor['temp_id'] . "'");
|
mysql_query("DELETE FROM temperature WHERE temp_id = '" . $sensor['temp_id'] . "'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user