Rename Skin::getUsableSkins() to Skin::getAllowedSkins()
authorWaldir Pimenta <waldir@email.com>
Sat, 25 May 2013 13:05:55 +0000 (14:05 +0100)
committerjeroendedauw <jeroendedauw@gmail.com>
Sun, 26 May 2013 09:53:58 +0000 (11:53 +0200)
Follow-up to change 65426 (commit a3c7a8b8f)

Also, rewrite the documentation for this function call in Preferences.php
To remove the "(skins is all skin names from Language.php)"
which I couldn't make sense of.

Change-Id: I0b0fdfb5615c22aa876882c3ca344ebb1f10c4bd

includes/Preferences.php
includes/Skin.php
includes/api/ApiQuerySiteinfo.php

index a6d530f..df80894 100644 (file)
@@ -1074,9 +1074,8 @@ class Preferences {
                $mptitle = Title::newMainPage();
                $previewtext = $context->msg( 'skin-preview' )->text();
 
-               # Only show members of Skin::getSkinNames() rather than
-               # $skinNames (skins is all skin names from Language.php)
-               $validSkinNames = Skin::getUsableSkins();
+               # Only show skins that aren't disabled in $wgSkipSkins
+               $validSkinNames = Skin::getAllowedSkins();
 
                # Sort by UI skin name. First though need to update validSkinNames as sometimes
                # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
index 15b8545..f117e79 100644 (file)
@@ -91,9 +91,9 @@ abstract class Skin extends ContextSource {
         * Fetch the list of user-selectable skins in regards to $wgSkipSkins.
         * Useful for Special:Preferences and other places where you
         * only want to show skins users _can_ use.
-        * @return array of strings
+        * @return string[]
         */
-       public static function getUsableSkins() {
+       public static function getAllowedSkins() {
                global $wgSkipSkins;
 
                $allowedSkins = self::getSkinNames();
@@ -105,6 +105,15 @@ abstract class Skin extends ContextSource {
                return $allowedSkins;
        }
 
+       /**
+        * @deprecated since 1.22, use getAllowedSkins
+        * @return string[]
+        */
+       public static function getUsableSkins() {
+               wfDeprecated( __METHOD__, '1.22' );
+               return self::getAllowedSkins();
+       }
+
        /**
         * Normalize a skin preference value to a form that can be loaded.
         * If a skin can't be found, it will fall back to the configured
index 09a0f3d..30d2425 100644 (file)
@@ -544,12 +544,12 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        public function appendSkins( $property ) {
                $data = array();
-               $usable = Skin::getUsableSkins();
+               $allowed = Skin::getAllowedSkins();
                $default = Skin::normalizeKey( 'default' );
                foreach ( Skin::getSkinNames() as $name => $displayName ) {
                        $skin = array( 'code' => $name );
                        ApiResult::setContent( $skin, $displayName );
-                       if ( !isset( $usable[$name] ) ) {
+                       if ( !isset( $allowed[$name] ) ) {
                                $skin['unusable'] = '';
                        }
                        if ( $name === $default ) {