From: Florian Date: Fri, 18 Dec 2015 02:26:23 +0000 (+0100) Subject: SpecialMyLanguage: Use page language instead of wiki language for redirect target... X-Git-Tag: 1.31.0-rc.0~5938^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22upgrade%22%2C%22reinstall=non%22%29%20.%20%22?a=commitdiff_plain;h=29cac40c821856b0eb6c47d2f396b599347653c3;p=lhc%2Fweb%2Fwiklou.git SpecialMyLanguage: Use page language instead of wiki language for redirect target check 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 --- diff --git a/includes/specials/SpecialMyLanguage.php b/includes/specials/SpecialMyLanguage.php index d11fbe638a..9cb6d4b529 100644 --- a/includes/specials/SpecialMyLanguage.php +++ b/includes/specials/SpecialMyLanguage.php @@ -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;