Index: trunk/phase3/tests/phpunit/includes/ArticleTablesTest.php |
— | — | @@ -5,9 +5,7 @@ |
6 | 6 | * @group Destructive |
7 | 7 | */ |
8 | 8 | class ArticleTablesTest extends MediaWikiLangTestCase { |
9 | | - /** |
10 | | - * @group Broken |
11 | | - */ |
| 9 | + |
12 | 10 | function testbug14404() { |
13 | 11 | global $wgUser, $wgContLang, $wgLanguageCode, $wgLang; |
14 | 12 | |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | var $mTouched = '19700101000000'; // !< |
65 | 65 | |
66 | 66 | /** |
67 | | - * @var ParserOptions |
| 67 | + * @var ParserOptions: ParserOptions object for $wgUser articles |
68 | 68 | */ |
69 | 69 | var $mParserOptions; |
70 | 70 | |
— | — | @@ -3541,7 +3541,7 @@ |
3542 | 3542 | $edit->revid = $revid; |
3543 | 3543 | $edit->newText = $text; |
3544 | 3544 | $edit->pst = $this->preSaveTransform( $text, $user, $popts ); |
3545 | | - $edit->popts = $this->getParserOptions(); |
| 3545 | + $edit->popts = $this->getParserOptions( true ); |
3546 | 3546 | $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $edit->popts, true, true, $revid ); |
3547 | 3547 | $edit->oldText = $this->getRawText(); |
3548 | 3548 | |
— | — | @@ -4329,12 +4329,23 @@ |
4330 | 4330 | |
4331 | 4331 | /** |
4332 | 4332 | * Get parser options suitable for rendering the primary article wikitext |
4333 | | - * @return ParserOptions object |
| 4333 | + * @param $canonical boolean Determines that the generated options must not depend on user preferences (see bug 14404) |
| 4334 | + * @return mixed ParserOptions object or boolean false |
4334 | 4335 | */ |
4335 | | - public function getParserOptions() { |
4336 | | - global $wgUser; |
4337 | | - if ( !$this->mParserOptions ) { |
4338 | | - $this->mParserOptions = $this->makeParserOptions( $wgUser ); |
| 4336 | + public function getParserOptions( $canonical = false ) { |
| 4337 | + global $wgUser, $wgLanguageCode; |
| 4338 | + |
| 4339 | + if ( !$this->mParserOptions || $canonical ) { |
| 4340 | + $user = !$canonical ? $wgUser : new User; |
| 4341 | + $parserOptions = new ParserOptions( $user ); |
| 4342 | + $parserOptions->setTidy( true ); |
| 4343 | + $parserOptions->enableLimitReport(); |
| 4344 | + |
| 4345 | + if ( $canonical ) { |
| 4346 | + $parserOptions->setUserLang( $wgLanguageCode ); # Must be set explicitely |
| 4347 | + return $parserOptions; |
| 4348 | + } |
| 4349 | + $this->mParserOptions = $parserOptions; |
4339 | 4350 | } |
4340 | 4351 | // Clone to allow modifications of the return value without affecting cache |
4341 | 4352 | return clone $this->mParserOptions; |