r38729 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38728‎ | r38729 | r38730 >
Date:17:41, 6 August 2008
Author:demon
Status:old
Tags:
Comment:
Logic for $wgSkipSkins should be in Skin.php, where it's usable by things other than preferences. (bug 6795)
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialPreferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialPreferences.php
@@ -517,7 +517,7 @@
518518 global $wgEnotifWatchlist, $wgEnotifUserTalk,$wgEnotifMinorEdits;
519519 global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
520520 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
521 - global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
 521+ global $wgContLanguageCode, $wgDefaultSkin, $wgAuth;
522522 global $wgEmailConfirmToEdit, $wgAjaxSearch, $wgEnableMWSuggest;
523523
524524 $wgOut->setPageTitle( wfMsg( 'preferences' ) );
@@ -819,7 +819,7 @@
820820 $previewtext = wfMsg('skin-preview');
821821 # Only show members of Skin::getSkinNames() rather than
822822 # $skinNames (skins is all skin names from Language.php)
823 - $validSkinNames = Skin::getSkinNames();
 823+ $validSkinNames = Skin::getUsableSkins();
824824 # Sort by UI skin name. First though need to update validSkinNames as sometimes
825825 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
826826 foreach ($validSkinNames as $skinkey => & $skinname ) {
@@ -829,9 +829,6 @@
830830 }
831831 asort($validSkinNames);
832832 foreach ($validSkinNames as $skinkey => $sn ) {
833 - if ( in_array( $skinkey, $wgSkipSkins ) ) {
834 - continue;
835 - }
836833 $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
837834
838835 $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
Index: trunk/phase3/includes/Skin.php
@@ -60,6 +60,21 @@
6161 }
6262 return $wgValidSkinNames;
6363 }
 64+
 65+ /**
 66+ * Fetch the list of usable skins in regards to $wgSkipSkins.
 67+ * Useful for Special:Preferences and other places where you
 68+ * only want to show skins users _can_ use.
 69+ * @return array of strings
 70+ */
 71+ public static function getUsableSkins() {
 72+ global $wgSkipSkins;
 73+ $usableSkins = self::getSkinNames();
 74+ foreach ( $wgSkipSkins as $skip ) {
 75+ unset( $usableSkins[$skip] );
 76+ }
 77+ return $usableSkins;
 78+ }
6479
6580 /**
6681 * Normalize a skin preference value to a form that can be loaded.

Status & tagging log