r54075 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54074‎ | r54075 | r54076 >
Date:07:12, 31 July 2009
Author:nikerabbit
Status:ok
Tags:
Comment:
* Fix sidebar purging code (still unknown to me what causes it to cache bad version)
* Add language code to the load method
Modified paths:
  • /trunk/phase3/includes/MessageCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/MessageCache.php
@@ -346,7 +346,7 @@
347347
348348 $res = $dbr->select( array( 'page', 'revision', 'text' ),
349349 array( 'page_title', 'old_text', 'old_flags' ),
350 - $smallConds, __METHOD__ );
 350+ $smallConds, __METHOD__. "($code)" );
351351
352352 for ( $row = $dbr->fetchObject( $res ); $row; $row = $dbr->fetchObject( $res ) ) {
353353 $cache[$row->page_title] = ' ' . Revision::getRevisionText( $row );
@@ -400,9 +400,18 @@
401401
402402 // Also delete cached sidebar... just in case it is affected
403403 global $parserMemc;
404 - $sidebarKey = wfMemcKey( 'sidebar', $code );
405 - $parserMemc->delete( $sidebarKey );
 404+ $codes = array( $code );
 405+ if ( $code === 'en' ) {
 406+ // Delete all sidebars, like for example on action=purge on the
 407+ // sidebar messages
 408+ $codes = array_keys( Language::getLanguageNames() );
 409+ }
406410
 411+ foreach ( $codes as $code ) {
 412+ $sidebarKey = wfMemcKey( 'sidebar', $code );
 413+ $parserMemc->delete( $sidebarKey );
 414+ }
 415+
407416 wfRunHooks( "MessageCacheReplace", array( $title, $text ) );
408417
409418 wfProfileOut( __METHOD__ );

Status & tagging log