From: Alexandre Emsenhuber Date: Mon, 25 Aug 2008 18:06:54 +0000 (+0000) Subject: (bug 15303) Title conversion for templates wasn't working in some cases X-Git-Tag: 1.31.0-rc.0~45672 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=05b0fbd558b131ea88d4756070c857b1059fff9e;p=lhc%2Fweb%2Fwiklou.git (bug 15303) Title conversion for templates wasn't working in some cases --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2b062a3a04..d9508efd42 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -46,7 +46,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * New URL syntaxes for Special:ListUsers - 'Special:ListUsers/USER' and 'Special:ListUsers/GROUP/USER', in addition to the older syntax 'Special:ListUsers/GROUP' where GROUP is a valid group name. -* Configurable er-namespace and per-page notices for the edit form, +* Configurable per-namespace and per-page notices for the edit form, respectively MediaWiki:Editnotice-# where # is the namespace number, and MediaWiki:Editnotice-#-PAGENAME where # is the page's namespace number and PAGENAME is the page name minus the namespace prefix. @@ -142,9 +142,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN addition to body text. * Navigation links to images available from a shared repository (like Commons) from their local talk pages no longer appear as redlinks -* Action=purge on ForeignApiFiles now works (purges their thumbnails and description - pages). - +* Action=purge on ForeignApiFiles now works (purges their thumbnails and + description pages). +* (bug 15303) Title conversion for templates wasn't working in some cases. === API changes in 1.14 === diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 9a1764b10b..a6d9f936d6 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2894,7 +2894,7 @@ class Parser $titleText = $title->getPrefixedText(); # Check for language variants if the template is not found if($wgContLang->hasVariants() && $title->getArticleID() == 0){ - $wgContLang->findVariantLink($part1, $title); + $wgContLang->findVariantLink( $part1, $title, true ); } # Do infinite loop check if ( !$frame->loopCheck( $title ) ) { diff --git a/includes/parser/Parser_OldPP.php b/includes/parser/Parser_OldPP.php index f7baae87dc..b1be18894b 100644 --- a/includes/parser/Parser_OldPP.php +++ b/includes/parser/Parser_OldPP.php @@ -3076,7 +3076,7 @@ class Parser_OldPP $titleText = $title->getPrefixedText(); # Check for language variants if the template is not found if($wgContLang->hasVariants() && $title->getArticleID() == 0){ - $wgContLang->findVariantLink($part1, $title); + $wgContLang->findVariantLink( $part1, $title, false ); } if ( !$title->isExternal() ) { diff --git a/languages/Language.php b/languages/Language.php index 6fa53045ee..44ac0628d7 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -39,7 +39,7 @@ class FakeConverter { function parserConvert($t, $p) {return $t;} function getVariants() { return array( $this->mLang->getCode() ); } function getPreferredVariant() {return $this->mLang->getCode(); } - function findVariantLink(&$l, &$n) {} + function findVariantLink(&$l, &$n, $forTemplate = false) {} function getExtraHashOptions() {return '';} function getParsedTitle() {return '';} function markNoConversion($text, $noParse=false) {return $text;} @@ -2107,8 +2107,8 @@ class Language { * @param $nt Mixed: the title object of the link * @return null the input parameters may be modified upon return */ - function findVariantLink( &$link, &$nt ) { - $this->mConverter->findVariantLink($link, $nt); + function findVariantLink( &$link, &$nt, $forTemplate = false ) { + $this->mConverter->findVariantLink($link, $nt, $forTemplate ); } /** diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 2b6ea7b471..1c3926c711 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -479,7 +479,7 @@ class LanguageConverter { * @return null the input parameters may be modified upon return * @public */ - function findVariantLink( &$link, &$nt ) { + function findVariantLink( &$link, &$nt, $forTemplate = false ) { global $wgDisableLangConversion, $wgDisableTitleConversion, $wgRequest, $wgUser; $isredir = $wgRequest->getText( 'redirect', 'yes' ); $action = $wgRequest->getText( 'action' ); @@ -489,8 +489,8 @@ class LanguageConverter { $ns=NS_MAIN; - if ( $disableLinkConversion || $isredir == 'no' || $action == 'edit' || $action == 'submit' - || $linkconvert == 'no' || $wgUser->getOption('noconvertlink') == 1 ) { + if ( $disableLinkConversion || ( !$forTemplate && ( $isredir == 'no' || $action == 'edit' + || $action == 'submit' || $linkconvert == 'no' || $wgUser->getOption('noconvertlink') == 1 ) ) ) { return; } diff --git a/languages/classes/LanguageKk.php b/languages/classes/LanguageKk.php index 34c5c39a74..40beca67e5 100644 --- a/languages/classes/LanguageKk.php +++ b/languages/classes/LanguageKk.php @@ -225,7 +225,7 @@ class KkConverter extends LanguageConverter { * names as they were * - do not try to find variants for usernames */ - function findVariantLink( &$link, &$nt ) { + function findVariantLink( &$link, &$nt, $forTemplate = false ) { // check for user namespace if(is_object($nt)){ $ns = $nt->getNamespace(); @@ -234,8 +234,8 @@ class KkConverter extends LanguageConverter { } $oldlink=$link; - parent::findVariantLink($link,$nt); - if($this->getPreferredVariant()==$this->mMainLanguageCode) + parent::findVariantLink( $link, $nt, $forTemplate ); + if( $this->getPreferredVariant()==$this->mMainLanguageCode ) $link=$oldlink; } diff --git a/languages/classes/LanguageKu.php b/languages/classes/LanguageKu.php index b3ddd7f6df..a1e0ccb535 100644 --- a/languages/classes/LanguageKu.php +++ b/languages/classes/LanguageKu.php @@ -148,7 +148,7 @@ class KuConverter extends LanguageConverter { * names as they were * - do not try to find variants for usernames */ - function findVariantLink( &$link, &$nt ) { + function findVariantLink( &$link, &$nt, $forTemplate = false ) { // check for user namespace if(is_object($nt)){ $ns = $nt->getNamespace(); @@ -157,8 +157,8 @@ class KuConverter extends LanguageConverter { } $oldlink=$link; - parent::findVariantLink($link,$nt); - if($this->getPreferredVariant()==$this->mMainLanguageCode) + parent::findVariantLink( $link, $nt, $forTemplate ); + if( $this->getPreferredVariant() == $this->mMainLanguageCode ) $link=$oldlink; } diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php index d57c733d32..781218ca0e 100644 --- a/languages/classes/LanguageSr.php +++ b/languages/classes/LanguageSr.php @@ -92,7 +92,7 @@ class SrConverter extends LanguageConverter { * names as they were * - do not try to find variants for usernames */ - function findVariantLink( &$link, &$nt ) { + function findVariantLink( &$link, &$nt, $forTemplate = false ) { // check for user namespace if(is_object($nt)){ $ns = $nt->getNamespace(); @@ -101,7 +101,7 @@ class SrConverter extends LanguageConverter { } $oldlink=$link; - parent::findVariantLink($link,$nt); + parent::findVariantLink( $link, $nt, $forTemplate ); if($this->getPreferredVariant()==$this->mMainLanguageCode) $link=$oldlink; }