28require_once __DIR__ .
'/../Maintenance.php';
52 parent::__construct();
53 $this->mDescription =
"Deletes local password for users.";
56 $this->
addOption(
'user',
'If specified, only checks the given user',
false,
true );
57 $this->
addOption(
'delete',
'Really delete. To prevent accidents, you must provide this flag.' );
58 $this->
addOption(
'prefix',
"Instead of deleting, make passwords invalid by prefixing with "
59 .
"':null:'. Make sure PasswordConfig has a 'null' entry. This is meant for testing before "
61 $this->
addOption(
'unprefix',
'Instead of deleting, undo the effect of --prefix.' );
69 $this->
fatalError(
"Exactly one of the 'delete', 'prefix', 'unprefix' options must be used\n" );
72 $passwordHashTypes = MediaWikiServices::getInstance()->getPasswordFactory()->getTypes();
74 !
isset( $passwordHashTypes[
'null'] )
75 || $passwordHashTypes[
'null'][
'class'] !== InvalidPassword::class
79'null' password entry missing. To use password prefixing, add
81to your configuration (and
remove once the passwords
were deleted).
87 $user = $this->
getOption(
'user',
false );
88 if ( $user !==
false ) {
90 if ( $this->user ===
false ) {
103 $this->
output(
"done. (wrote $this->total rows)\n" );
121 [
'user_password' => PasswordFactory::newInvalidPassword()->toString() ],
122 [
'user_name' => $userBatch ],
128 'user_password' ] ) ],
131 "user_password != " . $dbw->
addQuotes( PasswordFactory::newInvalidPassword()->toString() ),
132 'user_password IS NOT NULL',
133 'user_name' => $userBatch,
139 [
'user_password = ' . $dbw->
buildSubString(
'user_password', strlen(
':null:' ) + 1 ) ],
142 'user_name' => $userBatch,
148 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->waitForReplication();
161 if ( !
is_null( $this->user ) ) {
162 $this->
output(
"\t ... querying '$this->user'\n" );
170 $this->
output(
"\t ... querying from '$lastUsername'\n" );
171 $users = $dbw->selectFieldValues(
175 'user_name > ' . $dbw->addQuotes( $lastUsername ),
179 'LIMIT' => $this->getBatchSize(),
180 'ORDER BY' =>
'user_name ASC',
185 $lastUsername = end( $users );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgPasswordConfig
Configuration for built-in password types.
Delete unused local passwords.
execute()
Do the actual work.
__construct()
Default constructor.
string null $user
User to run on, or null for all.
int $total
Number of deleted passwords.
processUsers(array $userBatch, IDatabase $dbw)
getUserBatches()
This method iterates through the requested users and returns their names in batches of self::$mBatchS...
getUserDB()
Get the master DB handle for the current user batch.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
hasOption( $name)
Checks to see if a particular option exists.
getBatchSize()
Returns batch size.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
getOption( $name, $default=null)
Get an option, or return the default.
setBatchSize( $s=0)
Set the batch size.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
Advanced database interface for IDatabase handles that include maintenance methods.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those were