RedirectSpecialPage: handle interwiki redirects.
authordaniel <dkinzler@wikimedia.org>
Fri, 12 Jul 2019 10:13:33 +0000 (12:13 +0200)
committerdaniel <dkinzler@wikimedia.org>
Fri, 12 Jul 2019 12:04:11 +0000 (14:04 +0200)
commit41106688abbe6dfff61c5642924ced42af3f0d33
tree41e7aadde479435858e6ae2224dc050d6a212bae
parente0d2eabecf022886ad3ffc67de99cf13d236c8eb
RedirectSpecialPage: handle interwiki redirects.

Previously, WikiPage::performRequest() would assume that Titles returned
by RedirectSpecialPage::getRedirect() are local pages, and would set
$wgTitle to whatever was returned. That would lead to a confused state
where the skin would try to render for an interwiki Title.

Instead, WikiPage::performRequest() should wrap the interwiki redirect
in a call to Special:GoToInterwiki/xyz, just like
Title::getFullUrlForRedirect() does, but still avoid the HTTP redirect,
to avoid leaking private information via view counters (T109724).

There are two things to test:
1) call Special:MyLanguage with an interwiki prefix,
   e.g. Special:MyLanguage/wikipedia:XYZ.
2) create a page that contains an interwiki redirect,
   e.g. #REDIRECT [[wikipedia:XYZ]], then call Special:MyLanguage
   for that page.

For these tests, the user language should be the same as the content
language. That is the critical case. If the user language differs
from the content language, the problem would be obscured by another
bug which is addressed by Ib4cbeec47a877c473.

Bug: T227700
Change-Id: I2852c5a9774f0c76e49f1e3876fcfe85a305f9ce
includes/MediaWiki.php