From: Brion Vibber Date: Fri, 14 Apr 2006 08:26:35 +0000 (+0000) Subject: * (bug 5519) Allow sidebar cache to be disabled; disable it by default. X-Git-Tag: 1.31.0-rc.0~57496 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=2f292c5944f83f085382388dc77fb6a895122c5c;p=lhc%2Fweb%2Fwiklou.git * (bug 5519) Allow sidebar cache to be disabled; disable it by default. * If on, the sidebar navigation links are cached for users with the * current language set. This can save a touch of load on a busy site * by shaving off extra message lookups. * * However it is also fragile: changing the site configuration, or * having a variable $wgArticlePath, can produce broken links that * don't update as expected. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bef30ddc4a..1068272a43 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -66,6 +66,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5475) New pages feeds ignore "limit" argument * (bug 5184) CSS misapplied to elements in Special:Allmessages due to conflicting anchor identifiers +* (bug 5519) Allow sidebar cache to be disabled; disable it by default. + == Compatibility == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index c344207d4a..9c22bd704c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -750,6 +750,17 @@ $wgUseCategoryBrowser = false; */ $wgEnableParserCache = true; +/** + * If on, the sidebar navigation links are cached for users with the + * current language set. This can save a touch of load on a busy site + * by shaving off extra message lookups. + * + * However it is also fragile: changing the site configuration, or + * having a variable $wgArticlePath, can produce broken links that + * don't update as expected. + */ +$wgEnableSidebarCache = false; + /** * Under which condition should a page in the main namespace be counted * as a valid article? If $wgUseCommaCount is set to true, it will be diff --git a/includes/Skin.php b/includes/Skin.php index 5b2e56c734..1233cdd5f2 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1427,20 +1427,19 @@ END; * @access private */ function buildSidebar() { - global $wgDBname, $parserMemc; + global $wgDBname, $parserMemc, $wgEnableSidebarCache; global $wgLanguageCode, $wgContLanguageCode; $fname = 'SkinTemplate::buildSidebar'; wfProfileIn( $fname ); - if ($wgLanguageCode == $wgContLanguageCode) - $cacheSidebar = true; - else - $cacheSidebar = false; + $key = "{$wgDBname}:sidebar"; + $cacheSidebar = $wgEnableSidebarCache && + ($wgLanguageCode == $wgContLanguageCode); if ($cacheSidebar) { - $cachedsidebar=$parserMemc->get("{$wgDBname}:sidebar"); + $cachedsidebar = $parserMemc->get( $key ); if ($cachedsidebar!="") { wfProfileOut($fname); return $cachedsidebar; @@ -1476,7 +1475,7 @@ END; } } if ($cacheSidebar) - $cachednotice=$parserMemc->set("{$wgDBname}:sidebar",$bar,86400); + $cachednotice = $parserMemc->set( $key, $bar, 86400 ); wfProfileOut( $fname ); return $bar; }