mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
fix voltages discovery if no voltages in database
git-svn-id: http://www.observium.org/svn/observer/trunk@817 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -95,10 +95,11 @@ if ($device['os'] == "linux")
|
|||||||
## Delete removed sensors
|
## Delete removed sensors
|
||||||
|
|
||||||
$sql = "SELECT * FROM voltage AS V, devices AS D WHERE V.volt_host = D.device_id AND D.device_id = '".$device['device_id']."'";
|
$sql = "SELECT * FROM voltage AS V, devices AS D WHERE V.volt_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))
|
||||||
{
|
{
|
||||||
|
while ($sensor = mysql_fetch_array($query))
|
||||||
|
{
|
||||||
unset($exists);
|
unset($exists);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < count($volt_exists) && !$exists)
|
while ($i < count($volt_exists) && !$exists)
|
||||||
@@ -113,6 +114,7 @@ while ($sensor = mysql_fetch_array($query))
|
|||||||
echo("-");
|
echo("-");
|
||||||
mysql_query("DELETE FROM voltage WHERE volt_id = '" . $sensor['volt_id'] . "'");
|
mysql_query("DELETE FROM voltage WHERE volt_id = '" . $sensor['volt_id'] . "'");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($volt_exists); echo("\n");
|
unset($volt_exists); echo("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user