MediaWiki master
invalidateBotPasswords.php
Go to the documentation of this file.
1<?php
26
27// @codeCoverageIgnoreStart
28require_once __DIR__ . '/Maintenance.php';
29// @codeCoverageIgnoreEnd
30
37 public function __construct() {
38 parent::__construct();
39 $this->addOption( "user", "The username to operate on", false, true );
40 $this->addOption( "userid", "The user id to operate on", false, true );
41 $this->addDescription( "Invalidate a user's bot passwords" );
42 }
43
44 public function execute() {
45 $user = $this->validateUserOption( "A \"user\" or \"userid\" must be set to invalidate the bot passwords for" );
46
47 $res = BotPassword::invalidateAllPasswordsForUser( $user->getName() );
48
49 if ( $res ) {
50 $this->output( "Bot passwords invalidated for " . $user->getName() . "\n" );
51 } else {
52 $this->output( "No bot passwords invalidated for " . $user->getName() . "\n" );
53 }
54 }
55}
56
57// @codeCoverageIgnoreStart
58$maintClass = InvalidateBotPasswords::class;
59require_once RUN_MAINTENANCE_IF_MAIN;
60// @codeCoverageIgnoreEnd
Maintenance script to invalidate the bot passwords of a given user.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
output( $out, $channel=null)
Throw some output to the user.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
addDescription( $text)
Set the description text.
Utility class for bot passwords.