(bug 15303) Title conversion for templates wasn't working in some cases
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 25 Aug 2008 18:06:54 +0000 (18:06 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 25 Aug 2008 18:06:54 +0000 (18:06 +0000)
RELEASE-NOTES
includes/parser/Parser.php
includes/parser/Parser_OldPP.php
languages/Language.php
languages/LanguageConverter.php
languages/classes/LanguageKk.php
languages/classes/LanguageKu.php
languages/classes/LanguageSr.php

index 2b062a3..d9508ef 100644 (file)
@@ -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 ===
 
index 9a1764b..a6d9f93 100644 (file)
@@ -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 ) ) {
index f7baae8..b1be188 100644 (file)
@@ -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() ) {
index 6fa5304..44ac062 100644 (file)
@@ -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 );
        }
 
        /**
index 2b6ea7b..1c3926c 100644 (file)
@@ -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;
                }
 
index 34c5c39..40beca6 100644 (file)
@@ -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;
        }
 
index b3ddd7f..a1e0ccb 100644 (file)
@@ -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;
        }
 
index d57c733..781218c 100644 (file)
@@ -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;
        }