From 9ec103525da078d46fc2cf0a5ed34a690385120c Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Apr 2013 13:24:51 +0400 Subject: update_rss_feed: simplify debug reporting --- include/functions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index 8ac5753c9..004f4db2f 100644 --- a/include/functions.php +++ b/include/functions.php @@ -129,6 +129,9 @@ $utc_tz = new DateTimeZone('UTC'); $schema_version = false; + global $_debug_enabled; + $_debug_enabled = true; + /** * Print a timestamped debug message. * @@ -136,6 +139,10 @@ * @return void */ function _debug($msg) { + global $_debug_enabled; + + if (!$_debug_enabled) return; + $ts = strftime("%H:%M:%S", time()); if (function_exists('posix_getpid')) { $ts = "$ts/" . posix_getpid(); @@ -156,6 +163,15 @@ } // function _debug + function _debug_enable($enabled) { + global $_debug_enabled; + + $old = $_debug_enabled; + $_debug_enabled = $enabled; + + return $old; + } + /** * Purge a feed old posts. * -- cgit v1.2.3