From: Chad Horohoe Date: Thu, 11 Jun 2009 23:35:34 +0000 (+0000) Subject: Per code review: call allowPropChange() directly, and only reference the deprecated... X-Git-Tag: 1.31.0-rc.0~41413 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=9a97ba7bd0970077084722287f50542182cde4ce;p=lhc%2Fweb%2Fwiklou.git Per code review: call allowPropChange() directly, and only reference the deprecated methods if they're available, this way if someone _has_ implemented these, they will still get their desired results. Removed them so A) We don't encourage people to use them, and B) We don't fool ourselves with is_callable() --- diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index dd7954895f..5ac790c5c9 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -130,37 +130,15 @@ class AuthPlugin { * @return bool */ public function allowPropChange( $prop = '' ) { - return true; - } - - /** - * Can users change their Real Name? - * @deprecated Use allowPropChange() - * @return bool - */ - public function allowRealNameChange() { - wfDeprecated( __METHOD__ ); - return $this->allowPropChange( 'realname' ); - } - - /** - * Can users change their email address? - * @deprecated Use allowPropChange() - * @return bool - */ - public function allowEmailChange() { - wfDeprecated( __METHOD__ ); - return $this->allowPropChange( 'emailaddress' ); - } - - /** - * Can users change their Nickname? - * @deprecated Use allowPropChange() - * @return bool - */ - public function allowNickChange() { - wfDeprecated( __METHOD__ ); - return $this->allowPropChange( 'nickname' ); + if( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) { + return $this->allowRealNameChange(); + } elseif( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) { + return $this->allowEmailChange(); + } elseif( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) { + return $this->allowNickChange(); + } else { + return true; + } } /** diff --git a/includes/Preferences.php b/includes/Preferences.php index b5c3c01f50..5326d700c4 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -152,7 +152,7 @@ class Preferences { global $wgAuth; $defaultPreferences['realname'] = array( - 'type' => $wgAuth->allowRealNameChange() ? 'text' : 'info', + 'type' => $wgAuth->allowPropChange( 'realname' ) ? 'text' : 'info', 'default' => $user->getRealName(), 'section' => 'personal/info', 'label-message' => 'yourrealname', @@ -260,7 +260,7 @@ class Preferences { global $wgMaxSigChars; $defaultPreferences['nickname'] = array( - 'type' => $wgAuth->allowNickChange() ? 'text' : 'info', + 'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info', 'maxlength' => $wgMaxSigChars, 'label-message' => 'yournick', 'validation-callback' => @@ -281,7 +281,7 @@ class Preferences { $defaultPreferences['emailaddress'] = array( - 'type' => $wgAuth->allowEmailChange() ? 'text' : 'info', + 'type' => $wgAuth->allowPropChange( 'emailaddress' ) ? 'text' : 'info', 'default' => $user->getEmail(), 'section' => 'personal/email', 'label-message' => 'youremail',