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
@@ -751,6 +751,17 @@
752752 $wgEnableParserCache = true;
753753
754754 /**
 755+ * If on, the sidebar navigation links are cached for users with the
 756+ * current language set. This can save a touch of load on a busy site
 757+ * by shaving off extra message lookups.
 758+ *
 759+ * However it is also fragile: changing the site configuration, or
 760+ * having a variable $wgArticlePath, can produce broken links that
 761+ * don't update as expected.
 762+ */
 763+$wgEnableSidebarCache = false;
 764+
 765+/**
755766 * Under which condition should a page in the main namespace be counted
756767 * as a valid article? If $wgUseCommaCount is set to true, it will be
757768 * counted if it contains at least one comma. If it is set to false
Index: trunk/phase3/includes/Skin.php
@@ -1427,20 +1427,19 @@
14281428 * @access private
14291429 */
14301430 function buildSidebar() {
1431 - global $wgDBname, $parserMemc;
 1431+ global $wgDBname, $parserMemc, $wgEnableSidebarCache;
14321432 global $wgLanguageCode, $wgContLanguageCode;
14331433
14341434 $fname = 'SkinTemplate::buildSidebar';
14351435
14361436 wfProfileIn( $fname );
14371437
1438 - if ($wgLanguageCode == $wgContLanguageCode)
1439 - $cacheSidebar = true;
1440 - else
1441 - $cacheSidebar = false;
 1438+ $key = "{$wgDBname}:sidebar";
 1439+ $cacheSidebar = $wgEnableSidebarCache &&
 1440+ ($wgLanguageCode == $wgContLanguageCode);
14421441
14431442 if ($cacheSidebar) {
1444 - $cachedsidebar=$parserMemc->get("{$wgDBname}:sidebar");
 1443+ $cachedsidebar = $parserMemc->get( $key );
14451444 if ($cachedsidebar!="") {
14461445 wfProfileOut($fname);
14471446 return $cachedsidebar;
@@ -1476,7 +1475,7 @@
14771476 }
14781477 }
14791478 if ($cacheSidebar)
1480 - $cachednotice=$parserMemc->set("{$wgDBname}:sidebar",$bar,86400);
 1479+ $cachednotice = $parserMemc->set( $key, $bar, 86400 );
14811480 wfProfileOut( $fname );
14821481 return $bar;
14831482 }
Index: trunk/phase3/RELEASE-NOTES
@@ -66,7 +66,9 @@
6767 * (bug 5475) New pages feeds ignore "limit" argument
6868 * (bug 5184) CSS misapplied to elements in Special:Allmessages due to conflicting
6969 anchor identifiers
 70+* (bug 5519) Allow sidebar cache to be disabled; disable it by default.
7071
 72+
7173 == Compatibility ==
7274
7375 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]