From 7b9d10e1683ca21ecbd30c6e15466c5dc3caca31 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 15 Nov 2005 23:50:23 +0000 Subject: [PATCH] * Password changing script for idiot users with amnesia --- maintenance/changePassword.php | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 maintenance/changePassword.php diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php new file mode 100644 index 0000000000..1e015fdcb4 --- /dev/null +++ b/maintenance/changePassword.php @@ -0,0 +1,51 @@ + + * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later + */ + +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 ) + ), + array( + 'user_id' => $this->user->getID() + ), + $fname + ); + } +} +if ( in_array( '--help', $argv ) ) + die( + "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" + ); + +$optionsWithArgs = array( 'user', 'password' ); +require_once 'commandLine.inc'; + +$cp = new ChangePassword( @$options['user'], @$options['password'] ); +$cp->main(); -- 2.20.1