From 3113acaff1e9a7ec42efc4d2cf3a28321b353737 Mon Sep 17 00:00:00 2001 From: quix0r Date: Wed, 10 Mar 2010 01:49:18 +0000 Subject: [PATCH] Even more performance hacks --- inc/filters.php | 4 ++-- inc/functions.php | 12 ++++++------ inc/libs/admins_functions.php | 4 ++-- inc/load_config.php | 2 +- inc/wrapper-functions.php | 25 +++++++++++++++++++------ install.php | 2 +- 6 files changed, 31 insertions(+), 18 deletions(-) diff --git a/inc/filters.php b/inc/filters.php index a7a36334f8..4028bef01f 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -913,8 +913,8 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__); // Store it in session - setSession('mxchange_member_failures' , getUserData('login_failures')); - setSession('mxchange_member_last_failure', getUserData('last_failure')); + setSession('mailer_member_failures' , getUserData('login_failures')); + setSession('mailer_member_last_failure', getUserData('last_failure')); } // END - if } diff --git a/inc/functions.php b/inc/functions.php index 0a6f17f48f..d45f5e5663 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2940,14 +2940,14 @@ function handleLoginFailures ($accessLevel) { $OUT = ''; // Is the session data set? - if ((isSessionVariableSet('mxchange_' . $accessLevel . '_failures')) && (isSessionVariableSet('mxchange_' . $accessLevel . '_last_failure'))) { + if ((isSessionVariableSet('mailer_' . $accessLevel . '_failures')) && (isSessionVariableSet('mailer_' . $accessLevel . '_last_failure'))) { // Ignore zero values - if (getSession('mxchange_' . $accessLevel . '_failures') > 0) { + if (getSession('mailer_' . $accessLevel . '_failures') > 0) { // Non-guest has login failures found, get both data and prepare it for template //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "accessLevel={$accessLevel}
"); $content = array( - 'login_failures' => getSession('mxchange_' . $accessLevel . '_failures'), - 'last_failure' => generateDateTime(getSession('mxchange_' . $accessLevel . '_last_failure'), 2) + 'login_failures' => getSession('mailer_' . $accessLevel . '_failures'), + 'last_failure' => generateDateTime(getSession('mailer_' . $accessLevel . '_last_failure'), 2) ); // Load template @@ -2955,8 +2955,8 @@ function handleLoginFailures ($accessLevel) { } // END - if // Reset session data - setSession('mxchange_' . $accessLevel . '_failures', ''); - setSession('mxchange_' . $accessLevel . '_last_failure', ''); + setSession('mailer_' . $accessLevel . '_failures', ''); + setSession('mailer_' . $accessLevel . '_last_failure', ''); } // END - if // Return rendered content diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 8c692aa43b..de6dcd93b8 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -648,8 +648,8 @@ function FILTER_ADD_EXTRA_SQL_DATA ($add = '') { // Reset the login failures function FILTER_RESET_ADMINS_LOGIN_FAILURES ($data) { // Store it in session - setSession('mxchange_admin_failures' , getAdminLoginFailures($data['login'])); - setSession('mxchange_admin_last_failure', getAdminLastFailure($data['login'])); + setSession('mailer_admin_failures' , getAdminLoginFailures($data['login'])); + setSession('mailer_admin_last_failure', getAdminLastFailure($data['login'])); // Prepare update data $postData['login'][getCurrentAdminId()] = $data['login']; diff --git a/inc/load_config.php b/inc/load_config.php index bd18a92522..2a59160ec1 100644 --- a/inc/load_config.php +++ b/inc/load_config.php @@ -53,7 +53,7 @@ $GLOBALS['config_local_loaded'] = false; // Is the local configuration there? if ((isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')) && (isIncludeReadable('inc/config.php'))) { // We are better in installation mode - $GLOBALS['mxchange_installing'] = true; + $GLOBALS['mailer_installing'] = true; // Define default main_title here setConfigEntry('MAIN_TITLE', 'Your mail-exchange title'); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 881b7c94e6..c81d9d09d3 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -277,13 +277,13 @@ function detectServerName () { // Check wether we are installing function isInstalling () { // Determine wether we are installing - if (!isset($GLOBALS['mxchange_installing'])) { + if (!isset($GLOBALS['mailer_installing'])) { // Check URL (css.php/js.php need this) - $GLOBALS['mxchange_installing'] = isGetRequestParameterSet('installing'); + $GLOBALS['mailer_installing'] = isGetRequestParameterSet('installing'); } // END - if // Return result - return $GLOBALS['mxchange_installing']; + return $GLOBALS['mailer_installing']; } // Check wether this script is installed @@ -326,7 +326,14 @@ function isInstalled () { // Check wether an admin is registered function isAdminRegistered () { - return ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y')); + // Is cache set? + if (!isset($GLOBALS['is_admin_registered'])) { + // Simply check it + $GLOBALS['is_admin_registered'] = ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y')); + } // END - if + + // Return it + return $GLOBALS['is_admin_registered']; } // Checks wether the reset mode is active @@ -337,8 +344,14 @@ function isResetModeEnabled () { // Checks wether the debug mode is enabled function isDebugModeEnabled () { - // Simply check it - return ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y')); + // Is cache set? + if (!isset($GLOBALS['is_debugmode_enabled'])) { + // Simply check it + $GLOBALS['is_debugmode_enabled'] = ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y')); + } // END - if + + // Return it + return $GLOBALS['is_debugmode_enabled']; } // Checks wether SQL debugging is enabled diff --git a/install.php b/install.php index 56d31a6e6d..5053ac7b82 100644 --- a/install.php +++ b/install.php @@ -57,7 +57,7 @@ require('inc/libs/security_functions.php'); $GLOBALS['startTime'] = microtime(true); // Tell every module / require file we are installing -$GLOBALS['mxchange_installing'] = true; +$GLOBALS['mailer_installing'] = true; // Set CSS variable for "normal mode" $GLOBALS['output_mode'] = '0'; -- 2.39.5