Use protocol-relative URLs in mw.site.interwikiMap

At the moment, in mw.site.interwikiMap, URLs stored in the database
with relative protocols are converted to http or https depending
on the protocol of the user who last requested that the page be parsed.
However, this URL isn't updated for users pulling pages from the page
cache, so they may see links with an incorrect protocol. Module authors
can work round this by using mw.uri objects and the isProtocolRelative
property, but it would be simpler just to use relative URLs from the
outset.

Change-Id: If0a169cfd1597e09706fc0e6d5cdcc821ba8d06a
This commit is contained in:
Mr. Stradivarius 2014-12-25 03:06:17 +09:00
parent c58c528d28
commit ad34c2bd94

View file

@ -156,7 +156,7 @@ class Scribunto_LuaSiteLibrary extends Scribunto_LuaLibraryBase {
$prefix = $row['iw_prefix'];
$val = array(
'prefix' => $prefix,
'url' => wfExpandUrl( $row['iw_url'], PROTO_CURRENT ),
'url' => wfExpandUrl( $row['iw_url'], PROTO_RELATIVE ),
'isProtocolRelative' => substr( $row['iw_url'], 0, 2 ) === '//',
'isLocal' => isset( $row['iw_local'] ) && $row['iw_local'] == '1',
'isTranscludable' => isset( $row['iw_trans'] ) && $row['iw_trans'] == '1',