r64821 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64820‎ | r64821 | r64822 >
Date:19:17, 9 April 2010
Author:philip
Status:deferred
Tags:
Comment:
Bug 23115: Follow up on r64819. Apply on 1.16wmf4.
Modified paths:
  • /branches/wmf/1.16wmf4/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/parser/Parser.php
@@ -305,7 +305,7 @@
306306 * to internalParse() which does all the real work.
307307 */
308308
309 - global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion;
 309+ global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgUser, $wgRequest, $wgDisableTitleConversion;
310310 $fname = __METHOD__.'-' . wfGetCaller();
311311 wfProfileIn( __METHOD__ );
312312 wfProfileIn( $fname );
@@ -349,13 +349,11 @@
350350 /**
351351 * The page doesn't get language converted if
352352 * a) It's disabled
353 - * b) Titles aren't converted
354 - * c) Content isn't converted and this is not a talk page
355 - * d) It's a conversion table
 353+ * c) Content isn't converted
 354+ * d) It's a conversion table
356355 */
357356 if ( !( $wgDisableLangConversion
358 - || isset( $this->mDoubleUnderscores['notitleconvert'] )
359 - || ( isset( $this->mDoubleUnderscores['nocontentconvert'] ) && !$this->mTitle->isTalkPage() )
 357+ || isset( $this->mDoubleUnderscores['nocontentconvert'] )
360358 || $this->mTitle->isConversionTable() ) ) {
361359
362360 # The position of the convert() call should not be changed. it
@@ -365,12 +363,34 @@
366364 $text = $wgContLang->convert( $text );
367365 }
368366
369 - // A title may have been set in a conversion rule.
370 - // Note that if a user tries to set a title in a conversion
371 - // rule but content conversion was not done, then the parser
372 - // won't pick it up. This is probably expected behavior.
373 - if ( $wgContLang->getConvRuleTitle() ) {
374 - $this->mOutput->setTitleText( $wgContLang->getConvRuleTitle() );
 367+ /**
 368+ * A page get its title converted except:
 369+ * a) Content convert is globally disabled
 370+ * b) Title convert is globally disabled
 371+ * c) The page is a redirect page
 372+ * d) User request with a "linkconvert" set to "no"
 373+ * e) A "nocontentconvert" magic word has been set
 374+ * f) A "notitleconvert" magic word has been set
 375+ * g) User sets "noconvertlink" in his/her preference
 376+ *
 377+ * Note that if a user tries to set a title in a conversion
 378+ * rule but content conversion was not done, then the parser
 379+ * won't pick it up. This is probably expected behavior.
 380+ */
 381+ if ( !( $wgDisableContentConversion
 382+ || $wgDisableTitleConversion
 383+ || $wgRequest->getText( 'redirect', 'yes' ) == 'no'
 384+ || $wgRequest->getText( 'linkconvert', 'yes' ) == 'no'
 385+ || isset( $this->mDoubleUnderscores['nocontentconvert'] )
 386+ || isset( $this->mDoubleUnderscores['notitleconvert'] )
 387+ || $wgUser->getOption( 'noconvertlink' ) == 1 ) ) {
 388+ $convruletitle = $wgContLang->getConvRuleTitle();
 389+ if ( $convruletitle ) {
 390+ $this->mOutput->setTitleText( $convruletitle );
 391+ }
 392+ else {
 393+ $this->mOutput->setTitleText( $wgContLang->convert( $title->getText() ) );
 394+ }
375395 }
376396
377397 $text = $this->mStripState->unstripNoWiki( $text );

Follow-up revisions

RevisionCommit summaryAuthorDate
r64851Fix bug 23115 again. Follow up r64821, r64823 and r64827. Rewrite the convert...philip05:46, 10 April 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64819Bug 23115: Follow up on r64811. Fix another bug which cause talk page can't c...philip19:02, 9 April 2010

Status & tagging log