r108153 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108152‎ | r108153 | r108154 >
Date:17:54, 5 January 2012
Author:nikerabbit
Status:ok
Tags:
Comment:
Hopefully fix nasty bug where message cache interferes with the parser state, causing StripState to throw an exception
Modified paths:
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -31,22 +31,16 @@
3232
3333 // Set display title
3434 $page = TranslatablePage::isTranslationPage( $title );
35 - if ( $page ) {
36 - list( , $code ) = TranslateUtils::figureMessage( $title->getText() );
37 - $name = $page->getPageDisplayTitle( $code );
 35+ if ( !$page ) {
 36+ return true;
 37+ }
3838
39 - if ( $name ) {
40 - $realFunction = array( 'MessageCache', 'singleton' );
 39+ list( , $code ) = TranslateUtils::figureMessage( $title->getText() );
 40+ $name = $page->getPageDisplayTitle( $code );
4141
42 - if ( is_callable( $realFunction ) ) {
43 - $cache = MessageCache::singleton();
44 - } else {
45 - global $wgMessageCache;
46 - $cache = $wgMessageCache;
47 - }
48 - $name = $cache->transform( $name, false, Language::factory( $code ) );
49 - $parser->getOutput()->setDisplayTitle( $name );
50 - }
 42+ if ( $name ) {
 43+ $name = $parser->recursivePreprocess( $name );
 44+ $parser->getOutput()->setDisplayTitle( $name );
5145 }
5246
5347 return true;

Status & tagging log