Page MenuHomePhabricator

Enhancements to API query siteinfo skin information (skipped usable default)
Closed, ResolvedPublic

Description

I'm building a lot of MediaWiki statistics and usage information on WikiApiary (http://wikiapiary.com/). It collects information via API, including Skin information (http://wikiapiary.com/wiki/Skin:Main_Page) and it would be really useful to have some additional information in this API method.

http://wikiapiary.com/w/api.php?action=query&meta=siteinfo&siprop=skins&format=json

This currently just displays the list of installed skins. My suggestions:

  1. Add a field to the result to indicate a skin is installed but is skipped via $wgSkipSkins. Currently skipping a skin in LocalSettings doesn't seem to affect the result of this API call.
  1. Add a field to the result to indicate a skin is set to the default via $wgDefaultSkin.

The result would then look something like (for JSON):

{

"query": {
    "skins": [
        {
            "*": "Standard",
            "code": "standard",
            "skip": true
        },
        {
            "*": "Nostalgia",
            "code": "nostalgia",
            "skip": true
        },
        {
            "*": "MonoBook",
            "code": "monobook"
        },
        {
            "*": "Vector",
            "code": "vector",
            "default": true
        }
    ]
}

}


Version: 1.22.0
Severity: enhancement

Details

Reference
bz47216

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:36 AM
bzimport set Reference to bz47216.

Related URL: https://gerrit.wikimedia.org/r/59146 (Gerrit Change Ib4ea5fe85e1b02895dba15f3a245c7a7d8724470)

I have a feeling that * is also not the actual label. We might want to grab the actual localized names from the i18n system and hand them out somewhere.

'*' indicated text content in json format, the value is the (english) display name. Calling the corrosponding messages (in content language) would be helpful.

In my opinion the api should not report skipped skins, nobody needs this information.

https://gerrit.wikimedia.org/r/59146 (Gerrit Change Ib4ea5fe85e1b02895dba15f3a245c7a7d8724470) | change APPROVED and MERGED [by jenkins-bot]

The original bug here is now fixed. It will probably be deployed along with 1.22wmf5, see https://www.mediawiki.org/wiki/MediaWiki_1.22/Roadmap for the schedule.

If someone really wants to request getting localized skin names from https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=skins instead of something like https://en.wikipedia.org/w/api.php?action=query&meta=allmessages&ammessages=skinname-monobook|skinname-vector|skinname-modern|skinname-cologneblue, file a separate bug. Note the current names being returned are not the English names, they're the internal names—note how "CologneBlue" is returned rather than "Cologne Blue".

And we're not going to arbitrarily filter out "core" skins from the result. Even less so now that we return an indicator of which skin is the default, which may well be one of the core skins.

It looks like this is now being deployed and it's a little odd. Looking at the diff [1] it's odd to me that unusable flag isn't coming through. It instead looks like the unusable skins are being omitted which I know was discussed in Comment 3 above so maybe that was how it was implemented in a later diff. (Which, by the way, I think is a good way to do it.)

The bigger item is that right now the value for default is '', rather than some form of boolean. This ends up looking odd, especially in the JSON format. Perhaps change the output to a boolean value?

http://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&siprop=skins

<?xml version="1.0"?>
<api>

<query>
  <skins>
    <skin code="cologneblue" xml:space="preserve">CologneBlue</skin>
    <skin code="modern" xml:space="preserve">Modern</skin>
    <skin code="monobook" xml:space="preserve">MonoBook</skin>
    <skin code="vector" default="" xml:space="preserve">Vector</skin>
  </skins>
</query>

</api>

http://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&siprop=skins&format=json

{"query":

{"skins":
  [
    {"code":"cologneblue","*":"CologneBlue"},
    {"code":"vector","*":"Vector","default":""},
    {"code":"monobook","*":"MonoBook"},
    {"code":"modern","*":"Modern"}
  ]
}

}

[1]: https://gerrit.wikimedia.org/r/#/c/59146/2/includes/api/ApiQuerySiteinfo.php

(In reply to comment #6)

It looks like this is now being deployed and it's a little odd. Looking at
the
diff [1] it's odd to me that unusable flag isn't coming through. It instead
looks like the unusable skins are being omitted which I know was discussed in
Comment 3 above so maybe that was how it was implemented in a later diff.

The "unusable" flag is for skins that are installed but are being disabled via $wgSkipSkins or some similar mechanism. There are currently no skins actually being disabled via this mechanism on WMF wikis, however.

The recent removal of various skins from core was actually that: the outright deletion of those skins.

The bigger item is that right now the value for default is '', rather than
some
form of boolean. This ends up looking odd, especially in the JSON format.

This is, unfortunately, the way that the API represents boolean results: the key is present (with value '') if true, and entirely absent if false.

Brad — thank you a ton for the further clarification. I've added handlers for this to my bots on WikiApiary and I thought you would like to know that unused/skipped skins are reported propertly. See this diff:

http://wikiapiary.com/w/index.php?title=Säsongsmat%2FSkins&diff=203953&oldid=196191

That's the first site I've seen report unused.

Thanks!

Updating the summary. This bug was hell to find, it was no-where in searches or even my own lists. I had to do a search of my all mails folder.

(In reply to comment #5)

If someone really wants to request getting localized skin names from
https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=skins
instead of something like
https://en.wikipedia.org/w/api.
php?action=query&meta=allmessages&ammessages=skinname-monobook|skinname-
vector|skinname-modern|skinname-cologneblue,
file a separate bug. Note the current names being returned are not the
English
names, they're the internal names—note how "CologneBlue" is returned rather
than "Cologne Blue".

Actually the're not even internal names. The value at this point is a key used to determine the class name of the skin. In the future it could be something strange and nonsensical like "{ThisIsMySkinClassName}" so we should really just be grabbing the English localized name if we're going to default anything there.