Merge "Remove Revision::getRevisionText from migrateArchiveText"
[lhc/web/wiklou.git] / maintenance / changePassword.php
index 316004b..aa45154 100644 (file)
@@ -52,19 +52,15 @@ class ChangePassword extends Maintenance {
                        $this->fatalError( "No such user: " . $this->getOption( 'user' ) );
                }
                $password = $this->getOption( 'password' );
-               try {
-                       $status = $user->changeAuthenticationData( [
-                               'username' => $user->getName(),
-                               'password' => $password,
-                               'retype' => $password,
-                       ] );
-                       if ( !$status->isGood() ) {
-                               throw new PasswordError( $status->getWikiText( null, null, 'en' ) );
-                       }
-                       $user->saveSettings();
+               $status = $user->changeAuthenticationData( [
+                       'username' => $user->getName(),
+                       'password' => $password,
+                       'retype' => $password,
+               ] );
+               if ( $status->isGood() ) {
                        $this->output( "Password set for " . $user->getName() . "\n" );
-               } catch ( PasswordError $pwe ) {
-                       $this->fatalError( $pwe->getText() );
+               } else {
+                       $this->fatalError( $status->getMessage( false, false, 'en' )->text() );
                }
        }
 }