r50776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50775‎ | r50776 | r50777 >
Date:16:23, 19 May 2009
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Per code review: Redo these allowBlah() functions (except allowPasswordChange) into a general allowPropChange(), update Preferences to use this. Checked extensions in SVN using AuthPlugin and none have implemented any of the allow*() functions, so nothing should break.
Modified paths:
  • /trunk/phase3/includes/AuthPlugin.php (modified) (history)
  • /trunk/phase3/includes/Preferences.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/AuthPlugin.php
@@ -123,42 +123,26 @@
124124 }
125125
126126 /**
127 - * Can users change their passwords?
 127+ * Allow a property change? Properties are the same as preferences
 128+ * and use the same keys. 'Realname' 'Emailaddress' and 'Nickname'
 129+ * all reference this.
128130 *
129131 * @return bool
130132 */
131 - public function allowPasswordChange() {
 133+ public function allowPropChange( $prop = '' ) {
132134 return true;
133135 }
134 -
135 - /**
136 - * Can users change their Real Name?
137 - *
138 - * @return bool
139 - */
140 - public function allowRealNameChange() {
141 - return true;
142 - }
143136
144137 /**
145 - * Can users change their email address?
 138+ * Can users change their passwords?
146139 *
147140 * @return bool
148141 */
149 - public function allowEmailChange() {
 142+ public function allowPasswordChange() {
150143 return true;
151144 }
152145
153146 /**
154 - * Can users change their Nickname?
155 - *
156 - * @return bool
157 - */
158 - public function allowNickChange() {
159 - return true;
160 - }
161 -
162 - /**
163147 * Set the given password in the authentication database.
164148 * As a special case, the password may be set to null to request
165149 * locking the password to an unusable value, with the expectation
Index: trunk/phase3/includes/Preferences.php
@@ -142,7 +142,7 @@
143143 if ($wgAllowRealName) {
144144 $defaultPreferences['realname'] =
145145 array(
146 - 'type' => $wgAuth->allowRealNameChange() ? 'text' : 'info',
 146+ 'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info',
147147 'default' => $user->getRealName(),
148148 'section' => 'personal/info',
149149 'label-message' => 'yourrealname',
@@ -252,7 +252,7 @@
253253 global $wgMaxSigChars;
254254 $defaultPreferences['nickname'] =
255255 array(
256 - 'type' => $wgAuth->allowNickChange() ? 'text' : 'info',
 256+ 'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
257257 'maxlength' => $wgMaxSigChars,
258258 'label-message' => 'yournick',
259259 'validation-callback' =>
@@ -273,7 +273,7 @@
274274
275275 $defaultPreferences['emailaddress'] =
276276 array(
277 - 'type' => $wgAuth->allowEmailChange() ? 'text' : 'info',
 277+ 'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'text' : 'info',
278278 'default' => $user->getEmail(),
279279 'section' => 'personal/email',
280280 'label-message' => 'youremail',

Follow-up revisions

RevisionCommit summaryAuthorDate
r50809Follow-up to r50776. Retaining old method names for backwards compatibility,...charlie04:30, 20 May 2009

Comments

#Comment by Simetrical (talk | contribs)   17:29, 19 May 2009

There are presumably out-of-tree users of these interfaces. Surely it would be harmless to keep the old ones as special cases inside allowPropChange() for backward compatibility.

#Comment by 😂 (talk | contribs)   04:38, 20 May 2009

Done in r50809

Status & tagging log