Page MenuHomePhabricator

Interwiki redirects are not allowed within one server
Open, LowPublic

Description

Author: rotemliss

Description:
If I set up two wikis in one server and link them using interwiki links
(iw_local=1), the redirect http://domain.com/wiki1/index.php/wiki2:Main_Page
does not work (I get "Bad title" error) and vice versa. However, if I set up two
wikis in two servers and link *them* using interwiki links (iw_local=1), the
redirect http://wiki1.domain.com/index.php/wiki2:Main_Page *does* work. The
problem is caused by line 141 of Wiki.php, when the following "if" statement is
used to choose whether to redirect, or to show a "Bad title" error message:

/* Check for a redirect loop */
if ( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url
) && $title->isLocal() )

$url is the redirected URL, and the if statement checks if we redirect within
the same server. It's good for Wikimedia sites, but not good for sites which use
two wikis in one server. Why is this check necessary at all? Which URL can cause
a redirect loop?


Version: unspecified
Severity: minor

Details

Reference
bz7102

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:27 PM
bzimport set Reference to bz7102.
bzimport added a subscriber: Unknown Object (MLST).

Are you putting relative paths in the interwiki table? If so, this is probably bug 18664.

rotemliss wrote:

(In reply to comment #1)

Are you putting relative paths in the interwiki table? If so, this is probably
bug 18664.

No, the URLs are absolute. The bug still exists. The line in includes/Wiki.php is now 196.

Relevant code is now on line 236 of includes/MediaWiki.php.

Removed testme, as this code hasn't changed since 2006 when this was filed.

No idea how this should be fixed. Seems evil to me.