From: Philip Tzou Date: Fri, 9 Apr 2010 19:02:04 +0000 (+0000) Subject: Bug 23115: Follow up on r64811. Fix another bug which cause talk page can't converted... X-Git-Tag: 1.31.0-rc.0~37194 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=99240b49460fe3b7013ab8d7dd24d9714676bdf3;p=lhc%2Fweb%2Fwiklou.git Bug 23115: Follow up on r64811. Fix another bug which cause talk page can't converted. And fix the title convert problem. --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 22257f6a23..b78deca7ee 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -303,7 +303,7 @@ class Parser { * to internalParse() which does all the real work. */ - global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion; + global $wgUseTidy, $wgAlwaysUseTidy, $wgContLang, $wgDisableLangConversion, $wgUser, $wgRequest, $wgDisableTitleConversion; $fname = __METHOD__.'-' . wfGetCaller(); wfProfileIn( __METHOD__ ); wfProfileIn( $fname ); @@ -347,13 +347,11 @@ class Parser { /** * The page doesn't get language converted if * a) It's disabled - * b) Titles aren't converted - * c) Content isn't converted and this is not a talk page - * d) It's a conversion table + * c) Content isn't converted + * d) It's a conversion table */ if ( !( $wgDisableLangConversion - || isset( $this->mDoubleUnderscores['notitleconvert'] ) - || ( isset( $this->mDoubleUnderscores['nocontentconvert'] ) && !$this->mTitle->isTalkPage() ) + || isset( $this->mDoubleUnderscores['nocontentconvert'] ) || $this->mTitle->isConversionTable() ) ) { # The position of the convert() call should not be changed. it @@ -363,12 +361,34 @@ class Parser { $text = $wgContLang->convert( $text ); } - # A title may have been set in a conversion rule. - # Note that if a user tries to set a title in a conversion - # rule but content conversion was not done, then the parser - # won't pick it up. This is probably expected behavior. - if ( $wgContLang->getConvRuleTitle() ) { - $this->mOutput->setTitleText( $wgContLang->getConvRuleTitle() ); + /** + * A page get its title converted except: + * a) Content convert is globally disabled + * b) Title convert is globally disabled + * c) The page is a redirect page + * d) User request with a "linkconvert" set to "no" + * e) A "nocontentconvert" magic word has been set + * f) A "notitleconvert" magic word has been set + * g) User sets "noconvertlink" in his/her preference + * + * Note that if a user tries to set a title in a conversion + * rule but content conversion was not done, then the parser + * won't pick it up. This is probably expected behavior. + */ + if ( !( $wgDisableContentConversion + || $wgDisableTitleConversion + || $wgRequest->getText( 'redirect', 'yes' ) == 'no' + || $wgRequest->getText( 'linkconvert', 'yes' ) == 'no' + || isset( $this->mDoubleUnderscores['nocontentconvert'] ) + || isset( $this->mDoubleUnderscores['notitleconvert'] ) + || $wgUser->getOption( 'noconvertlink' ) == 1 ) ) { + $convruletitle = $wgContLang->getConvRuleTitle(); + if ( $convruletitle ) { + $this->mOutput->setTitleText( $convruletitle ); + } + else { + $this->mOutput->setTitleText( $wgContLang->convert( $title->getText() ) ); + } } $text = $this->mStripState->unstripNoWiki( $text );