r64819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64818‎ | r64819 | r64820 >
Date:19:02, 9 April 2010
Author:philip
Status:resolved (Comments)
Tags:
Comment:
Bug 23115: Follow up on r64811. Fix another bug which cause talk page can't converted. And fix the title convert problem.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -303,7 +303,7 @@
304304 * to internalParse() which does all the real work.
305305 */
306306
307 - global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion;
 307+ global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgUser, $wgRequest, $wgDisableTitleConversion;
308308 $fname = __METHOD__.'-' . wfGetCaller();
309309 wfProfileIn( __METHOD__ );
310310 wfProfileIn( $fname );
@@ -347,13 +347,11 @@
348348 /**
349349 * The page doesn't get language converted if
350350 * a) It's disabled
351 - * b) Titles aren't converted
352 - * c) Content isn't converted and this is not a talk page
353 - * d) It's a conversion table
 351+ * c) Content isn't converted
 352+ * d) It's a conversion table
354353 */
355354 if ( !( $wgDisableLangConversion
356 - || isset( $this->mDoubleUnderscores['notitleconvert'] )
357 - || ( isset( $this->mDoubleUnderscores['nocontentconvert'] ) && !$this->mTitle->isTalkPage() )
 355+ || isset( $this->mDoubleUnderscores['nocontentconvert'] )
358356 || $this->mTitle->isConversionTable() ) ) {
359357
360358 # The position of the convert() call should not be changed. it
@@ -363,12 +361,34 @@
364362 $text = $wgContLang->convert( $text );
365363 }
366364
367 - # A title may have been set in a conversion rule.
368 - # Note that if a user tries to set a title in a conversion
369 - # rule but content conversion was not done, then the parser
370 - # won't pick it up. This is probably expected behavior.
371 - if ( $wgContLang->getConvRuleTitle() ) {
372 - $this->mOutput->setTitleText( $wgContLang->getConvRuleTitle() );
 365+ /**
 366+ * A page get its title converted except:
 367+ * a) Content convert is globally disabled
 368+ * b) Title convert is globally disabled
 369+ * c) The page is a redirect page
 370+ * d) User request with a "linkconvert" set to "no"
 371+ * e) A "nocontentconvert" magic word has been set
 372+ * f) A "notitleconvert" magic word has been set
 373+ * g) User sets "noconvertlink" in his/her preference
 374+ *
 375+ * Note that if a user tries to set a title in a conversion
 376+ * rule but content conversion was not done, then the parser
 377+ * won't pick it up. This is probably expected behavior.
 378+ */
 379+ if ( !( $wgDisableContentConversion
 380+ || $wgDisableTitleConversion
 381+ || $wgRequest->getText( 'redirect', 'yes' ) == 'no'
 382+ || $wgRequest->getText( 'linkconvert', 'yes' ) == 'no'
 383+ || isset( $this->mDoubleUnderscores['nocontentconvert'] )
 384+ || isset( $this->mDoubleUnderscores['notitleconvert'] )
 385+ || $wgUser->getOption( 'noconvertlink' ) == 1 ) ) {
 386+ $convruletitle = $wgContLang->getConvRuleTitle();
 387+ if ( $convruletitle ) {
 388+ $this->mOutput->setTitleText( $convruletitle );
 389+ }
 390+ else {
 391+ $this->mOutput->setTitleText( $wgContLang->convert( $title->getText() ) );
 392+ }
373393 }
374394
375395 $text = $this->mStripState->unstripNoWiki( $text );

Follow-up revisions

RevisionCommit summaryAuthorDate
r64820Bug 23115: Follow up on r64819. Apply on REL1_16.philip19:16, 9 April 2010
r64821Bug 23115: Follow up on r64819. Apply on 1.16wmf4.philip19:17, 9 April 2010
r64822Follow up r64819. Cosmetical fixes.platonides19:35, 9 April 2010
r64828Follow-up r64819: PHP Notice: Undefined variable: wgDisableContentConversion ...raymond20:34, 9 April 2010
r64876Proposed cleanup of recent LanguageConverter-related commits:...tstarling13:38, 10 April 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r64811Bug 23115: Language Converter should apply on talk page.philip17:42, 9 April 2010

Comments

#Comment by Platonides (talk | contribs)   19:06, 9 April 2010

Why are you doing this? - || isset( $this->mDoubleUnderscores['notitleconvert'] ) - || ( isset( $this->mDoubleUnderscores['nocontentconvert'] ) && !$this->mTitle->isTalkPage() ) + || isset( $this->mDoubleUnderscores['nocontentconvert'] )

#Comment by PhiLiP (talk | contribs)   19:15, 9 April 2010

You know, "$text = $wgContLang->convert( $text )" will convert the content of a page. But the notitleconvert shouldn't effect on content, because content may contains title, but title doesn't contain content. And I don't think we should disable language converter in talk page, lots of people can't read other variants quickly, so I removed it and let the talk page converted again.

#Comment by PhiLiP (talk | contribs)   19:20, 9 April 2010

AND r61100 did my way too :)

#Comment by Platonides (talk | contribs)   19:26, 9 April 2010

You are right. notitleconvert only affects titles.

r61100 takes into account && !$this->mTitle->isTalkPage(), though.

#Comment by Platonides (talk | contribs)   19:36, 9 April 2010

From irc: the isTalkPage() was also new, added by mah on r60832.

Old behavior was to convert talk pages.

#Comment by Happy-melon (talk | contribs)   14:50, 15 December 2010

You're replacing tabs with spaces in one of the comments, which breaks alignment.

Status & tagging log