From 87bd0da996f45ac1b4a9bfdc824f78a2039d8464 Mon Sep 17 00:00:00 2001 From: mchasteen Date: Mon, 16 Feb 2015 16:33:56 -0700 Subject: [PATCH] Fixed polling ports so that NULL values don't break stuff. Basically I just have a foreach loop to unset any NULL values. Also fixed the NOW() SQL statements at the end of polling. --- includes/polling/functions.inc.php | 4 ++-- includes/polling/ports.inc.php | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index 4582426c4..b40a5f18a 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -223,9 +223,9 @@ function poll_device($device, $options) rrdtool_update($ping_rrd, "N:$ping_time"); } - $update_array['last_polled'] = array('NOW()'); + $update_array['last_polled'] = 'NOW()'; $update_array['last_polled_timetaken'] = $device_time; - $update_array['last_ping'] = array('NOW()'); + $update_array['last_ping'] = 'NOW()'; $update_array['last_ping_timetaken'] = $ping_time; #echo("$device_end - $device_start; $device_time $device_run"); diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index c8a18e885..6c43bf507 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -430,6 +430,12 @@ foreach ($ports as $port) $memcache->set('port-'.$port['port_id'].'-state', $port['state']); } + foreach ($port['update'] as $key => $val_check){ + if (!isset($val_check)) { + unset($port['update'][$key]); + } + } + // Update Database if (count($port['update'])) {