(bug 47216) API: indicate default and skipped skins in meta=siteinfo
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 15 Apr 2013 14:54:51 +0000 (10:54 -0400)
committerTim Starling <tstarling@wikimedia.org>
Thu, 16 May 2013 23:51:18 +0000 (09:51 +1000)
action=query&meta=siteinfo&siprop=skins can easily indicate which of the
returned skins is the default and which are unusable (e.g. because
they're listed in $wgSkipSkins). So we may as well do so.

Bug: 47216
Change-Id: Ib4ea5fe85e1b02895dba15f3a245c7a7d8724470

RELEASE-NOTES-1.22
includes/api/ApiQuerySiteinfo.php

index f9866f8..168f2f7 100644 (file)
@@ -106,6 +106,8 @@ production.
 * (bug 46626) xmldoublequote parameter was removed. Because of a bug, the
   parameter has had no effect since MediaWiki 1.16, and so its removal is
   unlikely to impact existing clients.
+* (bug 47216) action=query&meta=siteinfo&siprop=skins will now indicate which
+  skin is the default and which are unusable (e.g. listed in $wgSkipSkins).
 * (bug 25325) Added support for wlshow filtering (bots/anon/minor/patrolled)
   to action=feedwatchlist.
 * WDDX formatted output will actually be formatted (and normal output will no
index 37b22f1..09a0f3d 100644 (file)
@@ -544,9 +544,17 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        public function appendSkins( $property ) {
                $data = array();
+               $usable = Skin::getUsableSkins();
+               $default = Skin::normalizeKey( 'default' );
                foreach ( Skin::getSkinNames() as $name => $displayName ) {
                        $skin = array( 'code' => $name );
                        ApiResult::setContent( $skin, $displayName );
+                       if ( !isset( $usable[$name] ) ) {
+                               $skin['unusable'] = '';
+                       }
+                       if ( $name === $default ) {
+                               $skin['default'] = '';
+                       }
                        $data[] = $skin;
                }
                $this->getResult()->setIndexedTagName( $data, 'skin' );