From a92ce17f21b050557c9cc4f1c35913f893a6dbc1 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sat, 21 Aug 2010 12:54:42 +0000 Subject: [PATCH] disable warnings/errors if not debugging git-svn-id: http://www.observium.org/svn/observer/trunk@1688 61d68cd4-352d-0410-923a-c4978735b2b8 --- discovery.php | 21 ++++++++++++++++----- html/index.php | 6 ++++++ poller.php | 15 ++++++++++++++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/discovery.php b/discovery.php index 963c8dce7e..385aa8e3a2 100755 --- a/discovery.php +++ b/discovery.php @@ -36,6 +36,22 @@ if ($options['i'] && isset($options['n'])) { $doing = $options['n'] ."/".$options['i']; } +if (isset($options['d'])) { + echo("DEBUG!\n"); + $debug = TRUE; + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + ini_set('log_errors', 1); + ini_set('error_reporting', 1); +} else { + $debug = FALSE; + ini_set('display_errors', 0); + ini_set('display_startup_errors', 0); + ini_set('log_errors', 0); + ini_set('error_reporting', 0); +} + + if(!$where) { echo("-h | Poll single device\n"); echo("-h odd Poll odd numbered devices (same as -i 2 -n 0)\n"); @@ -95,11 +111,6 @@ if (file_exists('.svn')) } } - - -if(isset($options['d'])) { echo("DEBUG!\n"); $debug = 1; } else { $debug = 0; } - - $devices_discovered = 0; $device_query = mysql_query("SELECT * FROM `devices` WHERE status = 1 AND disabled = 0 $where ORDER BY device_id DESC"); diff --git a/html/index.php b/html/index.php index 33caf1be67..e244584b35 100755 --- a/html/index.php +++ b/html/index.php @@ -10,6 +10,12 @@ if(strpos($_SERVER['REQUEST_URI'], "debug")) { ini_set('display_startup_errors', 1); ini_set('log_errors', 1); ini_set('error_reporting', E_ALL); +} else { + $debug = FALSE; + ini_set('display_errors', 0); + ini_set('display_startup_errors', 0); + ini_set('log_errors', 0); + ini_set('error_reporting', 0); } include("../includes/defaults.inc.php"); diff --git a/poller.php b/poller.php index 53443ec8b5..b3ac73af7a 100755 --- a/poller.php +++ b/poller.php @@ -46,7 +46,20 @@ if (!$where) { exit; } -if (isset($options['d'])) { echo("DEBUG!\n"); $debug = 1; } +if (isset($options['d'])) { + echo("DEBUG!\n"); + $debug = TRUE; + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + ini_set('log_errors', 1); + ini_set('error_reporting', 1); +} else { + $debug = FALSE; + ini_set('display_errors', 0); + ini_set('display_startup_errors', 0); + ini_set('log_errors', 0); + ini_set('error_reporting', 0); +} echo("Starting polling run:\n\n");