27 require_once __DIR__ .
'/Maintenance.php';
36 parent::__construct();
37 $this->
addOption(
"user",
"The username to operate on",
false,
true );
38 $this->
addOption(
"userid",
"The user id to operate on",
false,
true );
39 $this->
addOption(
"password",
"The password to use",
true,
true );
46 } elseif ( $this->
hasOption(
"userid" ) ) {
49 $this->
error(
"A \"user\" or \"userid\" must be set to change the password for",
true );
52 $this->
error(
"No such user: " . $this->
getOption(
'user' ),
true );
54 $password = $this->
getOption(
'password' );
57 'username' =>
$user->getName(),
58 'password' => $password,
59 'retype' => $password,
64 $user->saveSettings();
65 $this->
output(
"Password set for " .
$user->getName() .
"\n" );
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
static newFromId($id)
Static factory method for creation from a given user ID.
hasOption($name)
Checks to see if a particular param exists.
require_once RUN_MAINTENANCE_IF_MAIN
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
addOption($name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
addDescription($text)
Set the description text.
getOption($name, $default=null)
Get an option, or return the default.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
output($out, $channel=null)
Throw some output to the user.
getText()
Get the text to display when reporting the error on the command line.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Show an error when any operation involving passwords fails to run.
error($err, $die=0)
Throw an error to the user.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
Maintenance script to change the password of a given user.