r79122 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79121‎ | r79122 | r79123 >
Date:18:44, 28 December 2010
Author:platonides
Status:reverted
Tags:
Comment:
Fix bug 14404. The articles are now always saved with the default options.
Most importantily, articles with {{int:X}} will now have consistent table
links no matter the language of the last saving user.
Existing articles with broken tables will be updated on a null edit (a purge is not enough).

Test added in r79121.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -41,7 +41,7 @@
4242 var $mTouched = '19700101000000'; // !<
4343 var $mUser = -1; // !< Not loaded
4444 var $mUserText = ''; // !< username from Revision if set
45 - var $mParserOptions; // !< ParserOptions object
 45+ var $mParserOptions; // !< ParserOptions object for $wgUser articles
4646 var $mParserOutput; // !< ParserCache object if set
4747 /**@}}*/
4848
@@ -3598,7 +3598,7 @@
35993599 $edit->revid = $revid;
36003600 $edit->newText = $text;
36013601 $edit->pst = $this->preSaveTransform( $text );
3602 - $edit->popts = $this->getParserOptions();
 3602+ $edit->popts = $this->getParserOptions( true );
36033603 $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $edit->popts, true, true, $revid );
36043604 $edit->oldText = $this->getContent();
36053605
@@ -4439,15 +4439,23 @@
44404440
44414441 /**
44424442 * 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)
44434444 * @return mixed ParserOptions object or boolean false
44444445 */
4445 - public function getParserOptions() {
4446 - global $wgUser;
 4446+ public function getParserOptions( $canonical = false ) {
 4447+ global $wgUser, $wgLanguageCode;
44474448
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;
44524460 }
44534461
44544462 // Clone to allow modifications of the return value without affecting

Follow-up revisions

RevisionCommit summaryAuthorDate
r79130MFT r79122 + RELEASE-NOTESplatonides20:00, 28 December 2010
r83868Revert r79122, causes bug 27891 (old version seen immediately after edit).tstarling04:26, 14 March 2011
r89706Reinstate r79122 (fix for bug 14404), reverting r83868. The real bug seem to ...platonides22:28, 7 June 2011
r97206Follow up r89706, building up on r97091....platonides21:09, 15 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79121Add failing test for bug 14404.platonides18:43, 28 December 2010

Status & tagging log