mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed the discovered_last field update thing.
This commit is contained in:
@@ -120,7 +120,11 @@ function dbUpdate($data, $table, $where = null, $parameters = array()) {
|
||||
// but how merge these field placeholders with actual $parameters array for the WHERE clause
|
||||
$sql = 'UPDATE `' . $table . '` SET ';
|
||||
foreach($data as $key => $value) {
|
||||
$sql .= "`".$key."` = '" . $value . "',";
|
||||
if ($value == "NOW()") {
|
||||
$sql .= "`".$key."` = " . $value . ",";
|
||||
} else {
|
||||
$sql .= "`".$key."` = '" . $value . "',";
|
||||
}
|
||||
}
|
||||
$sql = substr($sql, 0, -1); // strip off last comma
|
||||
|
||||
|
||||
@@ -118,8 +118,8 @@ function discover_device($device, $options = NULL)
|
||||
}
|
||||
|
||||
$device_end = utime(); $device_run = $device_end - $device_start; $device_time = substr($device_run, 0, 5);
|
||||
|
||||
dbUpdate(array('last_discovered' => array('NOW()'), 'type' => $device['type'], 'last_discovered_timetaken' => $device_time), 'devices', '`device_id` = ?', array($device['device_id']));
|
||||
|
||||
dbUpdate(array('last_discovered' => 'NOW()', 'type' => $device['type'], 'last_discovered_timetaken' => $device_time), 'devices', '`device_id` = ?', array($device['device_id']));
|
||||
|
||||
echo("Discovered in $device_time seconds\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user