Fix a race condition in classic edit toolbar setup
[lhc/web/wiklou.git] / maintenance / changePassword.php
index 30b07d6..cfcac40 100644 (file)
@@ -43,13 +43,12 @@ class ChangePassword extends Maintenance {
                } else {
                        $this->error( "A \"user\" or \"userid\" must be set to change the password for" , true );
                }
-               if ( !$user->getId() ) {
+               if ( !$user || !$user->getId() ) {
                        $this->error( "No such user: " . $this->getOption( 'user' ), true );
                }
                try {
                        $user->setPassword( $this->getOption( 'password' ) );
                        $user->saveSettings();
-                       $user->invalidateCache();
                        $this->output( "Password set for " . $user->getName() . "\n" );
                } catch ( PasswordError $pwe ) {
                        $this->error( $pwe->getText(), true );