Index: trunk/phase3/includes/Article.php |
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | var $mTouched = '19700101000000'; // !< |
43 | 43 | var $mUser = -1; // !< Not loaded |
44 | 44 | var $mUserText = ''; // !< username from Revision if set |
45 | | - var $mParserOptions; // !< ParserOptions object |
| 45 | + var $mParserOptions; // !< ParserOptions object for $wgUser articles |
46 | 46 | var $mParserOutput; // !< ParserCache object if set |
47 | 47 | /**@}}*/ |
48 | 48 | |
— | — | @@ -3598,7 +3598,7 @@ |
3599 | 3599 | $edit->revid = $revid; |
3600 | 3600 | $edit->newText = $text; |
3601 | 3601 | $edit->pst = $this->preSaveTransform( $text ); |
3602 | | - $edit->popts = $this->getParserOptions(); |
| 3602 | + $edit->popts = $this->getParserOptions( true ); |
3603 | 3603 | $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $edit->popts, true, true, $revid ); |
3604 | 3604 | $edit->oldText = $this->getContent(); |
3605 | 3605 | |
— | — | @@ -4439,15 +4439,23 @@ |
4440 | 4440 | |
4441 | 4441 | /** |
4442 | 4442 | * Get parser options suitable for rendering the primary article wikitext |
| 4443 | + * @param $canonical boolean Determines that the generated must not depend on user preferences (see bug 14404) |
4443 | 4444 | * @return mixed ParserOptions object or boolean false |
4444 | 4445 | */ |
4445 | | - public function getParserOptions() { |
4446 | | - global $wgUser; |
| 4446 | + public function getParserOptions( $canonical = false ) { |
| 4447 | + global $wgUser, $wgLanguageCode; |
4447 | 4448 | |
4448 | | - if ( !$this->mParserOptions ) { |
4449 | | - $this->mParserOptions = new ParserOptions( $wgUser ); |
4450 | | - $this->mParserOptions->setTidy( true ); |
4451 | | - $this->mParserOptions->enableLimitReport(); |
| 4449 | + if ( !$this->mParserOptions || $canonical ) { |
| 4450 | + $user = !$canonical ? $wgUser : new User; |
| 4451 | + $parserOptions = new ParserOptions( $user ); |
| 4452 | + $parserOptions->setTidy( true ); |
| 4453 | + $parserOptions->enableLimitReport(); |
| 4454 | + |
| 4455 | + if ( $canonical ) { |
| 4456 | + $parserOptions->setUserLang( $wgLanguageCode ); # Must be set explicitely |
| 4457 | + return $parserOptions; |
| 4458 | + } |
| 4459 | + $this->mParserOptions = $parserOptions; |
4452 | 4460 | } |
4453 | 4461 | |
4454 | 4462 | // Clone to allow modifications of the return value without affecting |