Merge "Rename Block to MediaWiki\Block\DatabaseBlock"
[lhc/web/wiklou.git] / includes / user / User.php
index 2f6deb5..e8ca7ce 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 use MediaWiki\Block\AbstractBlock;
+use MediaWiki\Block\DatabaseBlock;
 use MediaWiki\Block\SystemBlock;
 use MediaWiki\MediaWikiServices;
 use MediaWiki\Session\SessionManager;
@@ -1162,35 +1163,6 @@ class User implements IDBAccessObject, UserIdentity {
                return $this->checkPasswordValidity( $password )->isGood();
        }
 
-       /**
-        * Given unvalidated password input, return error message on failure.
-        *
-        * @param string $password Desired password
-        * @return bool|string|array True on success, string or array of error message on failure
-        * @deprecated since 1.33, use checkPasswordValidity
-        */
-       public function getPasswordValidity( $password ) {
-               wfDeprecated( __METHOD__, '1.33' );
-
-               $result = $this->checkPasswordValidity( $password );
-               if ( $result->isGood() ) {
-                       return true;
-               }
-
-               $messages = [];
-               foreach ( $result->getErrorsByType( 'error' ) as $error ) {
-                       $messages[] = $error['message'];
-               }
-               foreach ( $result->getErrorsByType( 'warning' ) as $warning ) {
-                       $messages[] = $warning['message'];
-               }
-               if ( count( $messages ) === 1 ) {
-                       return $messages[0];
-               }
-
-               return $messages;
-       }
-
        /**
         * Check if this is a valid password for this user
         *
@@ -1384,7 +1356,7 @@ class User implements IDBAccessObject, UserIdentity {
                if ( $user->isLoggedIn() ) {
                        $this->loadFromUserObject( $user );
                        if ( $user->getBlock() ) {
-                               // If this user is autoblocked, set a cookie to track the Block. This has to be done on
+                               // If this user is autoblocked, set a cookie to track the block. This has to be done on
                                // every session load, because an autoblocked editor might not edit again from the same
                                // IP address after being blocked.
                                $this->trackBlockWithCookie();
@@ -4384,7 +4356,7 @@ class User implements IDBAccessObject, UserIdentity {
                        return false;
                }
 
-               $userblock = Block::newFromTarget( $this->getName() );
+               $userblock = DatabaseBlock::newFromTarget( $this->getName() );
                if ( !$userblock ) {
                        return false;
                }
@@ -4406,7 +4378,9 @@ class User implements IDBAccessObject, UserIdentity {
                # blocked with createaccount disabled, prevent new account creation there even
                # when the user is logged in
                if ( $this->mBlockedFromCreateAccount === false && !$this->isAllowed( 'ipblock-exempt' ) ) {
-                       $this->mBlockedFromCreateAccount = Block::newFromTarget( null, $this->getRequest()->getIP() );
+                       $this->mBlockedFromCreateAccount = DatabaseBlock::newFromTarget(
+                               null, $this->getRequest()->getIP()
+                       );
                }
                return $this->mBlockedFromCreateAccount instanceof AbstractBlock
                        && $this->mBlockedFromCreateAccount->appliesToRight( 'createaccount' )