Page MenuHomePhabricator

InterWiki table retrieval through meta=siteinfo
Closed, ResolvedPublic

Description

Would it be possible to retrieve the InterWiki table through a request like this?
api.php?action=query&meta=siteinfo&siprop=interwiki

This shouldn't be hard to implement, simply retrieve the table from the DB as an array and spit it out.

Thanks in advance.


Version: unspecified
Severity: enhancement

Details

Reference
bz10096

Event Timeline

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

Created attachment 3758
Implements list=interwiki

Attached:

I've attached a patch (see attachment) that implements:

  • list=interwiki (iw) * List interwiki bindings.

Parameters:

iwcontinue     - Fill in the value returned by an earlier query to continue that query
                 Default: 0
iwlimit        - The maximum number of bindings to list.
                 Default: -1
iwfilter       - Filter to apply
                  "local": Only list local interwiki bindings
                  "nonlocal": Only list nonlocal interwiki bindings
                  "all": List all interwiki bindings
                 One value: local, nonlocal, all
                 Default: all

Example:

api.php?action=query&list=interwiki

Apply this patch from the MediaWiki root with patch -p1

Hmm,apparently attaching this comment to the attachment would've been better... well, I'm new to BugZilla ^^

I kept the original siteinfo - I don't think we should introduce an extra module for something like this. Also, no point in doing limits - the table wouldn't be that long (I wouldn't think) not to return it whole.

Fixed in r22975

(In reply to comment #3)

I kept the original siteinfo - I don't think we should introduce an extra
module for something like this. Also, no point in doing limits - the table
wouldn't be that long (I wouldn't think) not to return it whole.

Fixed in r22975

Thanks. However, the returned array uses number as keys rather than
prefixes, which I initially implemented. Now that might not make much
sense in XML format, but it does make sense in (say) PHP serialized
format, as it makes it easier to retrieve information about a known
interwiki prefix. Is there a way that we can make something that looks
like this in XML:

<query>

<interwiki>
    <iw prefix="fr" url="http://fr.wikipedia.org/wiki/$1" local="">
</interwiki>

</query>

But looks like this:

Array(

['query'] => Array(
    ['interwiki'] => Array(
        ['fr'] => Array(
            ['prefix'] => fr
            ['url'] => http://fr.wikipedia.org/wiki/$1
            ['local'] =>
        )
    )
)

)

in PHP?

Is this possible with setIndexedTagName? Thanks in advance,

Roan Kattouw