From a98d315700e9a8b15a15610fb02cee8410460ca4 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Wed, 13 Apr 2011 11:38:42 +0000 Subject: [PATCH] support NULL as low and high limits for sensors git-svn-id: http://www.observium.org/svn/observer/trunk@2070 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/functions.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index c9dca5daf..069929779 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -35,7 +35,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, if ($high_limit != $sensor_entry['sensor_limit']) { - $query = "UPDATE sensors SET `sensor_limit` = '".$high_limit."' WHERE `sensor_id` = '".$sensor_entry['sensor_id']."'"; + $query = "UPDATE sensors SET `sensor_limit` = " . ($high_limit == NULL ? 'NULL' : "'".$high_limit."'") . " WHERE `sensor_id` = '".$sensor_entry['sensor_id']."'"; mysql_query($query); if ($debug) { echo("$query\n". mysql_affected_rows() . " updated\n"); } echo("H"); @@ -54,7 +54,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr, if ($sensor_entry['sensor_limit_low'] != $low_limit) { - $query = "UPDATE sensors SET `sensor_limit_low` = '".$low_limit."' WHERE `sensor_id` = '".$sensor_entry['sensor_id']."'"; + $query = "UPDATE sensors SET `sensor_limit_low` = " . ($low_limit == NULL ? 'NULL' : "'".$low_limit."'") . " WHERE `sensor_id` = '".$sensor_entry['sensor_id']."'"; mysql_query($query); if ($debug) { echo("$query\n". mysql_affected_rows() . " updated\n"); } echo("L");