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