r35818 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35817‎ | r35818 | r35819 >
Date:20:24, 3 June 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* Cache sidebar for all languages
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -1650,24 +1650,18 @@
16511651 * Build an array that represents the sidebar(s), the navigation bar among them
16521652 *
16531653 * @return array
1654 - * @private
16551654 */
16561655 function buildSidebar() {
16571656 global $parserMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
1658 - global $wgLang, $wgContLang;
 1657+ global $wgLang;
 1658+ wfProfileIn( __METHOD__ );
16591659
1660 - $fname = 'SkinTemplate::buildSidebar';
 1660+ $key = wfMemcKey( 'sidebar', $wgLang->getCode() );
16611661
1662 - wfProfileIn( $fname );
1663 -
1664 - $key = wfMemcKey( 'sidebar' );
1665 - $cacheSidebar = $wgEnableSidebarCache &&
1666 - ($wgLang->getCode() == $wgContLang->getCode());
1667 -
1668 - if ($cacheSidebar) {
 1662+ if ( $wgEnableSidebarCache ) {
16691663 $cachedsidebar = $parserMemc->get( $key );
1670 - if ($cachedsidebar!="") {
1671 - wfProfileOut($fname);
 1664+ if ( $cachedsidebar ) {
 1665+ wfProfileOut( __METHOD__ );
16721666 return $cachedsidebar;
16731667 }
16741668 }
@@ -1683,7 +1677,7 @@
16841678 $heading = $line;
16851679 } else {
16861680 if (strpos($line, '|') !== false) { // sanity check
1687 - $line = explode( '|' , trim($line, '* '), 2 );
 1681+ $line = array_map('trim', explode( '|' , trim($line, '* '), 2 ) );
16881682 $link = wfMsgForContent( $line[0] );
16891683 if ($link == '-')
16901684 continue;
@@ -1713,9 +1707,8 @@
17141708 } else { continue; }
17151709 }
17161710 }
1717 - if ($cacheSidebar)
1718 - $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
1719 - wfProfileOut( $fname );
 1711+ if ( $wgEnableSidebarCache ) $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
 1712+ wfProfileOut( __METHOD__ );
17201713 return $bar;
17211714 }
17221715 }
Index: trunk/phase3/RELEASE-NOTES
@@ -132,6 +132,7 @@
133133 from other pages in their group.
134134 * (bug 14263) Show a diff of the revert on rollback notification page.
135135 * (bug 13434) Show a warning when hash identical files exist
 136+* Sidebar is now cached for all languages
136137
137138 === Bug fixes in 1.13 ===
138139

Status & tagging log