class ChangePassword {
var $dbw;
var $user, $password;
-
+
function ChangePassword( $user, $password ) {
$this->user = User::newFromName( $user );
$this->password = $password;
-
+
$this->dbw =& wfGetDB( DB_MASTER );
}
function main() {
$fname = 'ChangePassword::main';
-
+
$this->dbw->update( 'user',
array(
'user_password' => wfEncryptPassword( $this->user->getID(), $this->password )
require_once 'commandLine.inc';
if( in_array( '--help', $argv ) )
- die(
+ wfDie(
"Usage: php changePassword.php [--user=user --password=password | --help]\n" .
"\toptions:\n" .
"\t\t--help\tshow this message\n" .
$cp = new ChangePassword( @$options['user'], @$options['password'] );
$cp->main();
+?>