SpecialMyLanguage: Use page language instead of wiki language for redirect target...
authorFlorian <florian.schmidt.stargatewissen@gmail.com>
Fri, 18 Dec 2015 02:26:23 +0000 (03:26 +0100)
committerNikerabbit <niklas.laxstrom@gmail.com>
Tue, 23 Aug 2016 12:57:37 +0000 (12:57 +0000)
With the change, named in Follow up, it's possible for site owners to
allow to change the language of a page using a special page.
Theoretically, any page can have another or a different page language,
depending on, if the language was changed using the special page or not.
For Special:MyLanguage it isn't enough anymore to check, if the current
user language is the same as the default content language. It has to
check, if the page language (which can potentionally differ from the
default content language) is the same as the user language.

The problem:
If content language is the same as the user language, Special:MyLanguage
currently redirects to the "base page" of a page ("Testpage" instead of
"Testpage/de"), no matter, if the page language of the base part is
another one as the default content language. This can result in the
problem, that Special:MyLanguage redirects to a page, that has a
different language as the user language, even if a subpage with the user
language code exists. This is fixed with this change.

Follow up: I0f82b146fbe948f917c1

Bug: T121834
Change-Id: Ic9fc9049813c153111829d37a2c248dc0768e0fb

includes/specials/SpecialMyLanguage.php

index d11fbe6..9cb6d4b 100644 (file)
@@ -91,7 +91,7 @@ class SpecialMyLanguage extends RedirectSpecialArticle {
 
                $uiCode = $this->getLanguage()->getCode();
                $proposed = $base->getSubpage( $uiCode );
-               if ( $uiCode !== $this->getConfig()->get( 'LanguageCode' ) && $proposed && $proposed->exists() ) {
+               if ( $proposed && $proposed->exists() && $uiCode !== $base->getPageLanguage()->getCode() ) {
                        return $proposed;
                } elseif ( $provided && $provided->exists() ) {
                        return $provided;