X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fwrapper-functions.php;h=48db9bbc05b706263abad490660594bfce5b9fb4;hp=c81d9d09d30ff956b334d6c60580579376e254d3;hb=be81324dfff59fa3aeac6844d10afe8c15286dff;hpb=f4c3a7ea1b3a8695e403a665ed2a0ad74246ae67 diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index c81d9d09d3..48db9bbc05 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -356,13 +356,26 @@ function isDebugModeEnabled () { // Checks wether SQL debugging is enabled function isSqlDebuggingEnabled () { - return ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); + // Is cache set? + if (!isset($GLOBALS['is_sql_debug_enabled'])) { + // Determine if SQL debugging is enabled + $GLOBALS['is_sql_debug_enabled'] = ((isConfigEntrySet('DEBUG_SQL')) && (getConfig('DEBUG_SQL') == 'Y')); + } // END - if + + // Return it + return $GLOBALS['is_sql_debug_enabled']; } // Checks wether we shall debug regular expressions -function isDebugRegExpressionEnabled () { - // Simply check it - return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y')); +function isDebugRegularExpressionEnabled () { + // Is cache set? + if (!isset($GLOBALS['is_regular_exp_debug_enabled'])) { + // Simply check it + $GLOBALS['is_regular_exp_debug_enabled'] = ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y')); + } // END - if + + // Return it + return $GLOBALS['is_regular_exp_debug_enabled']; } // Checks wether the cache instance is valid @@ -700,16 +713,32 @@ function redirectToDereferedUrl ($URL) { // Wrapper function for checking if extension is installed and newer or same version function isExtensionInstalledAndNewer ($ext_name, $version) { + // Is an cache entry found? + if (!isset($GLOBALS['ext_installed_newer'][$ext_name][$version])) { + $GLOBALS['ext_installed_newer'][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version)); + } else { + // Cache hits should be incremented twice + incrementStatsEntry('cache_hits', 2); + } + // Return it - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=>'.$version.'
'; - return ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version)); + //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=>'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version]).'
'; + return $GLOBALS['ext_installed_newer'][$ext_name][$version]; } // Wrapper function for checking if extension is installed and older than given version function isExtensionInstalledAndOlder ($ext_name, $version) { + // Is an cache entry found? + if (!isset($GLOBALS['ext_installed_older'][$ext_name][$version])) { + $GLOBALS['ext_installed_older'][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version))); + } else { + // Cache hits should be incremented twice + incrementStatsEntry('cache_hits', 2); + } + // Return it - //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'<'.$version.'
'; - return ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version))); + //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'<'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version]).'
'; + return $GLOBALS['ext_installed_older'][$ext_name][$version]; } // Set username @@ -743,7 +772,14 @@ function isInstallationPhase () { // Checks wether the extension demo is actuve and the admin login is demo (password needs to be demo, too!) function isDemoModeActive () { - return ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo')); + // Is cache set? + if (!isset($GLOBALS['demo_mode_active'])) { + // Simply check it + $GLOBALS['demo_mode_active'] = ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo')); + } // END - if + + // Return it + return $GLOBALS['demo_mode_active']; } // Getter for PHP caching value @@ -837,7 +873,11 @@ function isUserDataValid () { // Setter for current userid function setCurrentUserId ($userid) { + // Set userid $GLOBALS['current_userid'] = bigintval($userid); + + // Unset it to re-determine the actual state + unset($GLOBALS['is_userdata_valid'][$userid]); } // Getter for current userid @@ -854,7 +894,7 @@ function getCurrentUserId () { // Checks if current userid is set function isCurrentUserIdSet () { - return isset($GLOBALS['current_userid']); + return ((isset($GLOBALS['current_userid'])) && ($GLOBALS['current_userid'] > 0)); } // Checks wether we are debugging template cache @@ -863,14 +903,14 @@ function isDebuggingTemplateCache () { } // Wrapper for fetchUserData() and getUserData() calls -function getFetchedUserData ($keyColumn, $userId, $valueColumn) { +function getFetchedUserData ($keyColumn, $userid, $valueColumn) { // Is it cached? if (!isset($GLOBALS['user_data_cache'][$userid][$keyColumn][$valueColumn])) { // Default is 'guest' $data = getMessage('USERNAME_GUEST'); // Can we fetch the user data? - if (($userId > 0) && (fetchUserData($userId, $keyColumn))) { + if (($userid > 0) && (fetchUserData($userid, $keyColumn))) { // Now get the data back $data = getUserData($valueColumn); } // END - if