r50782 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50781‎ | r50782 | r50783 >
Date:17:07, 19 May 2009
Author:demon
Status:ok
Tags:
Comment:
(bug 18761) Add setting to hide a list of preferences.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -201,6 +201,12 @@
202202 # If file cache or squid cache is on, just disable this (DWIMD).
203203 if( $wgUseFileCache || $wgUseSquid ) $wgShowIPinHeader = false;
204204
 205+# $wgAllowRealName was removed in 1.16 in favor of $wgHiddenPrefs,
 206+# handle b/c here
 207+if( !$wgAllowRealName ) {
 208+ $wgHiddenPrefs[] = 'realname';
 209+}
 210+
205211 wfProfileOut( $fname.'-misc1' );
206212 wfProfileIn( $fname.'-memcached' );
207213
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2496,9 +2496,15 @@
24972497 'disablemail' => 0,
24982498 );
24992499
2500 -/** Whether or not to allow and use real name fields. Defaults to true. */
 2500+/**
 2501+ * Whether or not to allow and use real name fields.
 2502+ * @deprecated in 1.16, use $wgHiddenPrefs[] = 'realname' below
 2503+ */
25012504 $wgAllowRealName = true;
25022505
 2506+/** An array of preferences to not show for the user */
 2507+$wgHiddenPrefs = array();
 2508+
25032509 /*****************************************************************************
25042510 * Extensions
25052511 */
Index: trunk/phase3/includes/Preferences.php
@@ -29,6 +29,14 @@
3030
3131 wfRunHooks( 'GetPreferences', array( $user, &$defaultPreferences ) );
3232
 33+ ## Remove preferences that wikis don't want to use
 34+ global $wgHiddenPrefs;
 35+ foreach ( $wgHiddenPrefs as $pref ) {
 36+ if ( isset( $defaultPreferences[$pref] ) ) {
 37+ unset( $defaultPreferences[ $pref ] );
 38+ }
 39+ }
 40+
3341 ## Prod in defaults from the user
3442 global $wgDefaultUserOptions;
3543 foreach( $defaultPreferences as $name => &$info ) {
@@ -138,19 +146,16 @@
139147 }
140148
141149 // Actually changeable stuff
142 - global $wgAllowRealName, $wgAuth;
143 - if ($wgAllowRealName) {
144 - $defaultPreferences['realname'] =
145 - array(
146 - 'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
147 - 'default' => $user->getRealName(),
148 - 'section' => 'personal/info',
149 - 'label-message' => 'yourrealname',
150 - 'help-message' => 'prefs-help-realname',
151 - );
152 - }
153 -
154 -
 150+ global $wgAuth;
 151+ $defaultPreferences['realname'] =
 152+ array(
 153+ 'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
 154+ 'default' => $user->getRealName(),
 155+ 'section' => 'personal/info',
 156+ 'label-message' => 'yourrealname',
 157+ 'help-message' => 'prefs-help-realname',
 158+ );
 159+
155160 $defaultPreferences['gender'] =
156161 array(
157162 'type' => 'select',
Index: trunk/phase3/RELEASE-NOTES
@@ -24,6 +24,10 @@
2525 * $wgSessionHandler can be used to configure session.save_handler
2626 * $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to
2727 be used when uploading/moving files
 28+* (bug 18761) $wgHiddenPrefs is a new array for specifying preferences not
 29+ to be shown to users
 30+* $wgAllowRealName was deprecated in favor of $wgHiddenPrefs[] = 'realname',
 31+ but the former is still retained for backwards-compatibility
2832
2933 === New features in 1.16 ===
3034

Follow-up revisions

RevisionCommit summaryAuthorDate
r50822Clarify comment on $wgAllowRealName deprecation...simetrical14:30, 20 May 2009
r50955Update per r50782:...robin12:09, 24 May 2009

Status & tagging log