From c248f2635adab08859daf9b8f1355cd334507343 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 10 Jan 2013 00:15:49 +0000 Subject: [PATCH] Added separate debugging of 'hourly' reset --- inc/config-functions.php | 1 + inc/config-local.php.dist | 3 +++ inc/daily/daily_user.php | 8 +++++--- inc/filters.php | 4 ++-- inc/wrapper-functions.php | 12 ++++++++++++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/inc/config-functions.php b/inc/config-functions.php index 527508c8d7..d284b5eabd 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -55,6 +55,7 @@ function initConfig () { 'num_templates' => 0, // 'DEFAULT_SALT_LENGTH' => 40, // 'DEBUG_MODE' => 'N', + // 'DEBUG_HOURLY' => 'N', // 'DEBUG_RESET' => 'N', // 'DEBUG_MONTHLY' => 'N', // 'DEBUG_WEEKLY' => 'N', diff --git a/inc/config-local.php.dist b/inc/config-local.php.dist index ebd74c4acc..49063403bf 100644 --- a/inc/config-local.php.dist +++ b/inc/config-local.php.dist @@ -89,6 +89,9 @@ setConfigEntry('DEBUG_TEMPLATE_CACHE', 'N'); // CFG: DEBUG-SQL (Logs all queries to inc/cache/mysql.log) //setConfigEntry('DEBUG_SQL', 'Y'); +// CFG: DEBUG-HOURLY (comment in to test hourly reset, comment out to not test) +//setConfigEntry('DEBUG_HOURLY', 'Y'); + // CFG: DEBUG-RESET (comment in to test daily reset, comment out to not test) //setConfigEntry('DEBUG_RESET', 'Y'); diff --git a/inc/daily/daily_user.php b/inc/daily/daily_user.php index a1637f1dd3..35483f6a76 100644 --- a/inc/daily/daily_user.php +++ b/inc/daily/daily_user.php @@ -41,7 +41,7 @@ if (!defined('__SECURITY')) { } elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; -} elseif (!isExtensionActive('sql_patches')) { +} elseif ((!isExtensionActive('sql_patches')) || (!isExtensionActive('user'))) { if (isDebugModeEnabled()) logDebugMessage(__FILE__, __LINE__, 'Not resetting, needed extension(s) ext-sql_patches/ext-user disabled.'); return; } @@ -58,7 +58,8 @@ SET `receive_mails`=`max_mails`, `mail_orders`=0 WHERE - `receive_mails` != `max_mails`', __FILE__, __LINE__); + `receive_mails` != `max_mails` + ' . runFilterChain('user_exclusion_sql', ' ') . '', __FILE__, __LINE__); } else { // Obsolete version SQL_QUERY('UPDATE @@ -66,7 +67,8 @@ WHERE SET `receive_mails`=`max_mails` WHERE - `receive_mails` != `max_mails`', __FILE__, __LINE__); + `receive_mails` != `max_mails` + ' . runFilterChain('user_exclusion_sql', ' ') . '', __FILE__, __LINE__); } // Transfer points from locked_points to points diff --git a/inc/filters.php b/inc/filters.php index 987d89326a..78aef62f1f 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -590,7 +590,7 @@ function FILTER_RUN_HOURLY_INCLUDES () { setIncludePool('hourly', getArrayFromDirectory('inc/hourly/', 'hourly_')); // Update database - if ((!isConfigEntrySet('DEBUG_RESET')) || (!isDebugResetEnabled())) { + if ((!isConfigEntrySet('DEBUG_HOURLY')) || (!isDebugHourlyEnabled())) { updateConfiguration('last_hour', getHour()); } // END - if @@ -825,7 +825,7 @@ function FILTER_RUN_HOURLY_RESET () { } // END - if // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D - if ((((isConfigEntrySet('last_hour')) && (getConfig('last_hour') != getHour())) || (isDebugResetEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (!isCssOutputMode())) { + if ((((isConfigEntrySet('last_hour')) && (getConfig('last_hour') != getHour())) || (isDebugHourlyEnabled())) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestElementSet('register')) && (!isCssOutputMode())) { // Tell every module we are in reset-mode! doHourly(); } // END - if diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 25e188c482..db7fa084b3 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -407,6 +407,18 @@ function isDebugModeEnabled () { return $GLOBALS[__FUNCTION__]; } +// Checks whether the debug hourly is enabled +function isDebugHourlyEnabled () { + // Is cache set? + if (!isset($GLOBALS[__FUNCTION__])) { + // Simply check it + $GLOBALS[__FUNCTION__] = ((isConfigEntrySet('DEBUG_HOURLY')) && (getConfig('DEBUG_HOURLY') == 'Y')); + } // END - if + + // Return it + return $GLOBALS[__FUNCTION__]; +} + // Checks whether the debug reset is enabled function isDebugResetEnabled () { // Is cache set? -- 2.39.5