diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2007-09-14 13:18:58 +0200 |
commit | 8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch) | |
tree | cd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /maintenance/changePassword.php | |
parent | d7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff) |
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'maintenance/changePassword.php')
-rw-r--r-- | maintenance/changePassword.php | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index 82913411..d6121280 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -9,12 +9,37 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ +$optionsWithArgs = array( 'user', 'password' ); +require_once 'commandLine.inc'; + +$USAGE = + "Usage: php changePassword.php [--user=user --password=password | --help]\n" . + "\toptions:\n" . + "\t\t--help show this message\n" . + "\t\t--user the username to operate on\n" . + "\t\t--password the password to use\n"; + +if( in_array( '--help', $argv ) ) + wfDie( $USAGE ); + +$cp = new ChangePassword( @$options['user'], @$options['password'] ); +$cp->main(); + class ChangePassword { var $dbw; var $user, $password; function ChangePassword( $user, $password ) { + global $USAGE; + if( !strlen( $user ) or !strlen( $password ) ) { + wfDie( $USAGE ); + } + $this->user = User::newFromName( $user ); + if ( !$this->user->getID() ) { + die ( "No such user: $user\n" ); + } + $this->password = $password; $this->dbw = wfGetDB( DB_MASTER ); @@ -35,18 +60,4 @@ class ChangePassword { } } -$optionsWithArgs = array( 'user', 'password' ); -require_once 'commandLine.inc'; - -if( in_array( '--help', $argv ) ) - wfDie( - "Usage: php changePassword.php [--user=user --password=password | --help]\n" . - "\toptions:\n" . - "\t\t--help\tshow this message\n" . - "\t\t--user\tthe username to operate on\n" . - "\t\t--password\tthe password to use\n" - ); -$cp = new ChangePassword( @$options['user'], @$options['password'] ); -$cp->main(); -?> |