X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialGoToInterwiki.php;h=e7f4107f20900a4b59a03beb1752d4158d7feb50;hb=4356572546b2b4e8eefda9bf10943ba1b12526b9;hp=809a14aac39e1ee33e0bb499ff2c339d858b2081;hpb=10d1b7d12b5d097413cd507740c5c71781c2580b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialGoToInterwiki.php b/includes/specials/SpecialGoToInterwiki.php index 809a14aac3..e7f4107f20 100644 --- a/includes/specials/SpecialGoToInterwiki.php +++ b/includes/specials/SpecialGoToInterwiki.php @@ -39,6 +39,19 @@ class SpecialGoToInterwiki extends UnlistedSpecialPage { } public function execute( $par ) { + // Allow forcing an interstitial for local interwikis. This is used + // when a redirect page is reached via a special page which resolves + // to a user-dependent value (as defined by + // RedirectSpecialPage::personallyIdentifiableTarget). See the hack + // for avoiding T109724 in MediaWiki::performRequest (which also + // explains why we can't use a query parameter instead). + // + // HHVM dies when substr_compare is used on an empty string so ensure it's not. + $force = ( substr_compare( $par ?: 'x', 'force/', 0, 6 ) === 0 ); + if ( $force ) { + $par = substr( $par, 6 ); + } + $this->setHeaders(); $target = Title::newFromText( $par ); // Disallow special pages as a precaution against @@ -50,9 +63,9 @@ class SpecialGoToInterwiki extends UnlistedSpecialPage { } $url = $target->getFullURL(); - if ( !$target->isExternal() || $target->isLocal() ) { + if ( !$target->isExternal() || ( $target->isLocal() && !$force ) ) { // Either a normal page, or a local interwiki. - // just redirect. + // Just redirect. $this->getOutput()->redirect( $url, '301' ); } else { $this->getOutput()->addWikiMsg( @@ -71,7 +84,7 @@ class SpecialGoToInterwiki extends UnlistedSpecialPage { } /** - * @return String + * @return string */ protected function getGroupName() { return 'redirects';