* (bug 5519) Allow sidebar cache to be disabled; disable it by default.
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 14 Apr 2006 08:26:35 +0000 (08:26 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 14 Apr 2006 08:26:35 +0000 (08:26 +0000)
 * 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.

RELEASE-NOTES
includes/DefaultSettings.php
includes/Skin.php

index bef30dd..1068272 100644 (file)
@@ -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 ==
 
index c344207..9c22bd7 100644 (file)
@@ -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
index 5b2e56c..1233cdd 100644 (file)
@@ -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;
        }