MediaWiki r13631 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r13630‎ | r13631 (on ViewVC)‎ | r13632 >
Date:08:26, 14 April 2006
Author:brion
Status:old
Tags:
Comment:
* (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.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 13630)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 13631)
@@ -751,6 +751,17 @@
 $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
  * counted if it contains at least one comma. If it is set to false
Index: trunk/phase3/includes/Skin.php
===================================================================
--- trunk/phase3/includes/Skin.php	(revision 13630)
+++ trunk/phase3/includes/Skin.php	(revision 13631)
@@ -1427,20 +1427,19 @@
 	 * @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 @@
 			}
 		}
 		if ($cacheSidebar)
-			$cachednotice=$parserMemc->set("{$wgDBname}:sidebar",$bar,86400);
+			$cachednotice = $parserMemc->set( $key, $bar, 86400 );
 		wfProfileOut( $fname );
 		return $bar;
 	}
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 13630)
+++ trunk/phase3/RELEASE-NOTES	(revision 13631)
@@ -66,7 +66,9 @@
 * (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 ==
 
 Older PHP 4.2 and 4.1 releases are no longer supported; PHP 4 users must

Follow-up revisions

Rev.Commit summaryAuthorDate
r13633merge from trunk:...brion08:50, 14 April 2006

Status & tagging log

  • 01:58, 13 October 2010 ^demon (Talk | contribs) changed the status of r13631 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox