Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/259968

Change subject: SpecialMyLanguage: Use page language instead of wgLanguageCode 
for redirect target check
......................................................................

SpecialMyLanguage: Use page language instead of wgLanguageCode 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
---
M includes/specials/SpecialMyLanguage.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/68/259968/1

diff --git a/includes/specials/SpecialMyLanguage.php 
b/includes/specials/SpecialMyLanguage.php
index 3d8ff97..0d22467 100644
--- a/includes/specials/SpecialMyLanguage.php
+++ b/includes/specials/SpecialMyLanguage.php
@@ -91,7 +91,7 @@
 
                $uiCode = $this->getLanguage()->getCode();
                $proposed = $base->getSubpage( $uiCode );
-               if ( $uiCode !== $this->getConfig()->get( 'LanguageCode' ) && 
$proposed && $proposed->exists() ) {
+               if ( $proposed && $uiCode !== $proposed->getPageLanguage() && 
$proposed->exists() ) {
                        return $proposed;
                } elseif ( $provided && $provided->exists() ) {
                        return $provided;

-- 
To view, visit https://gerrit.wikimedia.org/r/259968
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic9fc9049813c153111829d37a2c248dc0768e0fb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to