Per code review: call allowPropChange() directly, and only reference the deprecated...
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 11 Jun 2009 23:35:34 +0000 (23:35 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 11 Jun 2009 23:35:34 +0000 (23:35 +0000)
includes/AuthPlugin.php
includes/Preferences.php

index dd79548..5ac790c 100644 (file)
@@ -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;
+               }
        }
 
        /**
index b5c3c01..5326d70 100644 (file)
@@ -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',