From bf82e8d0f196949c121b777b151c8773e742d450 Mon Sep 17 00:00:00 2001 From: Waldir Pimenta Date: Sat, 25 May 2013 14:05:55 +0100 Subject: [PATCH] Rename Skin::getUsableSkins() to Skin::getAllowedSkins() 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 | 5 ++--- includes/Skin.php | 13 +++++++++++-- includes/api/ApiQuerySiteinfo.php | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index a6d530f567..df80894393 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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). diff --git a/includes/Skin.php b/includes/Skin.php index 15b85453b7..f117e79c74 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -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 diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 09a0f3d0be..30d2425c08 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -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 ) { -- 2.20.1