From 40e1a7b6e94b65320842ba0239f1d10757e1a571 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bruno=20Pr=C3=A9mont?= Date: Mon, 2 Mar 2009 09:24:39 +0100 Subject: [PATCH] contrib/php-collection: A few more bug-fixes to the graphing scripts. This removes some obsolete code which prevents flush from working and adds missing wrapper error500(). --- contrib/php-collection/functions.php | 11 ----------- contrib/php-collection/graph.php | 7 +++++++ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/contrib/php-collection/functions.php b/contrib/php-collection/functions.php index 9fb6116f..cb916abe 100644 --- a/contrib/php-collection/functions.php +++ b/contrib/php-collection/functions.php @@ -260,17 +260,6 @@ function collectd_flush($identifier) { if (is_null($identifier) || (is_array($identifier) && count($identifier) == 0) || !(is_string($identifier) || is_array($identifier))) return false; - if (is_null($host) || !is_string($host) || strlen($host) == 0) - return false; - if (is_null($plugin) || !is_string($plugin) || strlen($plugin) == 0) - return false; - if (is_null($pinst) || !is_string($pinst)) - return false; - if (is_null($type) || !is_string($type) || strlen($type) == 0) - return false; - if (is_null($tinst) || (is_array($tinst) && count($tinst) == 0) || !(is_string($tinst) || is_array($tinst))) - return false; - $u_errno = 0; $u_errmsg = ''; if ($socket = @fsockopen($config['collectd_sock'], 0, $u_errno, $u_errmsg)) { diff --git a/contrib/php-collection/graph.php b/contrib/php-collection/graph.php index e5365768..17749e06 100644 --- a/contrib/php-collection/graph.php +++ b/contrib/php-collection/graph.php @@ -112,6 +112,13 @@ function error400($title, $msg) { return error(400, "Bad request", $title, $msg); } +/** + * Incomplete / invalid request + */ +function error500($title, $msg) { + return error(500, "Internal error", $title, $msg); +} + // Process input arguments $host = read_var('host', $_GET, null); if (is_null($host)) -- 2.30.2