r112029 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112028‎ | r112029 | r112030 >
Date:17:34, 21 February 2012
Author:reedy
Status:ok
Tags:
Comment:
MFT r111698, r111780 to attempt to shut up some of the warnings
Modified paths:
  • /branches/wmf/1.18wmf1/extensions (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/FeaturedFeeds/FeaturedFeeds.body.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/FeaturedFeeds/FeaturedFeeds.body.php
@@ -250,6 +250,7 @@
251251 private $items = false;
252252 private $page = false;
253253 private $entryName;
 254+ private $titleForParse;
254255
255256 public $title = false;
256257 public $shortTitle;
@@ -257,11 +258,8 @@
258259
259260 public function __construct( $name, $options, $lang ) {
260261 global $wgContLang;
261 - if ( !self::$parserOptions ) {
262 - self::$parserOptions = new ParserOptions();
263 - self::$parserOptions->setEditSection( false );
264 - self::$parser = new Parser();
265 - }
 262+
 263+ self::staticInit();
266264 $this->name = $name;
267265 $this->options = $options;
268266 if ( $options['inUserLanguage'] ) {
@@ -271,6 +269,18 @@
272270 }
273271 }
274272
 273+ private static function staticInit() {
 274+ if ( !self::$parserOptions ) {
 275+ self::$parserOptions = new ParserOptions();
 276+ self::$parserOptions->setEditSection( false );
 277+ self::$parser = new Parser();
 278+ }
 279+ }
 280+
 281+ public function __wakeup() {
 282+ self::staticInit();
 283+ }
 284+
275285 /**
276286 * @param $key string
277287 * @return Message
@@ -364,8 +374,13 @@
365375 $this->name . '/' . wfTimestamp( TS_MW, $date ) . '/' . $this->language->getCode()
366376 )->getFullURL();
367377
 378+ if ( !isset( $this->titleForParse ) ) {
 379+ // parsing with such title makes stuff like {{CURRENTMONTH}} localised
 380+ $this->titleForParse = Title::newFromText( 'MediaWiki:Dummy/' . $this->language->getCode() );
 381+ }
 382+
368383 return new FeaturedFeedItem(
369 - self::$parser->transformMsg( $this->entryName, self::$parserOptions ),
 384+ self::$parser->transformMsg( $this->entryName, self::$parserOptions, $this->titleForParse ),
370385 wfExpandUrl( $url ),
371386 $text,
372387 $date
Property changes on: branches/wmf/1.18wmf1/extensions
___________________________________________________________________
Modified: svn:mergeinfo
373388 Merged /trunk/extensions:r111698,111780

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111698Bug 34448 - call to a member function setTimestamp() on a non-objectmaxsem23:00, 16 February 2012
r111780Use localised dates in feed entry titlesmaxsem19:50, 17 February 2012

Status & tagging log