Index: trunk/phase3/maintenance/changePassword.php |
— | — | @@ -29,13 +29,20 @@ |
30 | 30 | class ChangePassword extends Maintenance { |
31 | 31 | public function __construct() { |
32 | 32 | parent::__construct(); |
33 | | - $this->addOption( "user", "The username to operate on", true, true ); |
| 33 | + $this->addOption( "user", "The username to operate on", false, true ); |
| 34 | + $this->addOption( "userid", "The user id to operate on", false, true ); |
34 | 35 | $this->addOption( "password", "The password to use", true, true ); |
35 | 36 | $this->mDescription = "Change a user's password"; |
36 | 37 | } |
37 | 38 | |
38 | 39 | public function execute() { |
39 | | - $user = User::newFromName( $this->getOption( 'user' ) ); |
| 40 | + if ( $this->hasOption( "user" ) ) { |
| 41 | + $user = User::newFromName( $this->getOption( 'user' ) ); |
| 42 | + } elseif ( $this->hasOption( "userid" ) ) { |
| 43 | + $user = User::newFromId( $this->getOption( 'userid' ) ); |
| 44 | + } else { |
| 45 | + $this->error( "A \"user\" or \"userid\" must be set to change the password for" , true ); |
| 46 | + } |
40 | 47 | if ( !$user->getId() ) { |
41 | 48 | $this->error( "No such user: " . $this->getOption( 'user' ), true ); |
42 | 49 | } |