Index: branches/5.2.x/core/kernel/managers/cache_manager.php =================================================================== diff -u -N -r14728 -r14787 --- branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14728) +++ branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14787) @@ -1,6 +1,6 @@ $value); $this->Conn->doUpdate($fields_hash, TABLE_PREFIX . 'ConfigurationValues', 'VariableName = ' . $this->Conn->qstr($name)); - $this->DeleteUnitCache(); + if ( array_key_exists($name, $this->originalConfigVariables) && $value != $this->originalConfigVariables[$name] ) { + $this->DeleteUnitCache(); + } } /** @@ -336,63 +346,61 @@ } /** - * Deletes all data, that was cached during unit config parsing (including unit config locations) + * Deletes all data, that was cached during unit config parsing (excluding unit config locations) * - * @param bool $include_sections + * @param Array $config_variables * @access public */ - public function DeleteUnitCache($include_sections = false) + public function DeleteUnitCache($config_variables = null) { - if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) { + if ( isset($config_variables) && !array_intersect(array_keys($this->originalConfigVariables), $config_variables) ) { + // prevent cache reset, when given config variables are not in unit cache + return; + } + + if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) { $this->Application->rebuildCache('master:configs_parsed', kCache::REBUILD_LATER, CacheSettings::$unitCacheRebuildTime); } else { $this->Application->rebuildDBCache('configs_parsed', kCache::REBUILD_LATER, CacheSettings::$unitCacheRebuildTime); } + } - if ($include_sections) { - if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) { - $this->Application->rebuildCache('master:sections_parsed', kCache::REBUILD_LATER, CacheSettings::$sectionsParsedRebuildTime); - } - else { - $this->Application->rebuildDBCache('sections_parsed', kCache::REBUILD_LATER, CacheSettings::$sectionsParsedRebuildTime); - } + /** + * Deletes cached section tree, used during permission checking and admin console tree display + * + * @return void + * @access public + */ + public function DeleteSectionCache() + { + if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) { + $this->Application->rebuildCache('master:sections_parsed', kCache::REBUILD_LATER, CacheSettings::$sectionsParsedRebuildTime); } + else { + $this->Application->rebuildDBCache('sections_parsed', kCache::REBUILD_LATER, CacheSettings::$sectionsParsedRebuildTime); + } } /** - * Preloads widely used configuration variables, so they will get to cache for sure + * Preloads 21 widely used configuration variables, so they will get to cache for sure * * @access protected */ protected function preloadConfigVars() { $config_vars = Array ( // session related - 'SessionTimeout', - 'SessionCookieName', - 'SessionCookieDomains', - 'SessionBrowserSignatureCheck', - 'SessionIPAddressCheck', - 'CookieSessions', - 'KeepSessionOnBrowserClose', - 'User_GuestGroup', - 'User_LoggedInGroup', - 'RegistrationUsernameRequired', + 'SessionTimeout', 'SessionCookieName', 'SessionCookieDomains', 'SessionBrowserSignatureCheck', + 'SessionIPAddressCheck', 'CookieSessions', 'KeepSessionOnBrowserClose', 'User_GuestGroup', + 'User_LoggedInGroup', 'RegistrationUsernameRequired', // output related - 'UseModRewrite', - 'UseContentLanguageNegotiation', - 'UseOutputCompression', - 'OutputCompressionLevel', - 'Config_Site_Time', - 'SystemTagCache', + 'UseModRewrite', 'UseContentLanguageNegotiation', 'UseOutputCompression', 'OutputCompressionLevel', + 'Config_Site_Time', 'SystemTagCache', // tracking related - 'UseChangeLog', - 'UseVisitorTracking', - 'ModRewriteUrlEnding', - 'ForceModRewriteUrlEnding', + 'UseChangeLog', 'UseVisitorTracking', 'ModRewriteUrlEnding', 'ForceModRewriteUrlEnding', 'UseCronForRegularEvent', ); @@ -412,12 +420,14 @@ /** * Sets data from cache to object * + * Used for cases, when ConfigValue is called before LoadApplicationCache method (e.g. session init, url engine init) + * * @param Array $data * @access public */ public function setFromCache(&$data) { - $this->configVariables = $data['Application.ConfigHash']; + $this->configVariables = $this->originalConfigVariables = $data['Application.ConfigHash']; $this->configIDs = $this->originalConfigIDs = $data['Application.ConfigCacheIds']; }