MediaWiki master
invalidateBotPasswords.php
Go to the documentation of this file.
1<?php
12
13// @codeCoverageIgnoreStart
14require_once __DIR__ . '/Maintenance.php';
15// @codeCoverageIgnoreEnd
16
23 public function __construct() {
24 parent::__construct();
25 $this->addOption( "user", "The username to operate on", false, true );
26 $this->addOption( "userid", "The user id to operate on", false, true );
27 $this->addDescription( "Invalidate a user's bot passwords" );
28 }
29
30 public function execute() {
31 $user = $this->validateUserOption( "A \"user\" or \"userid\" must be set to invalidate the bot passwords for" );
32
33 $res = BotPassword::invalidateAllPasswordsForUser( $user->getName() );
34
35 if ( $res ) {
36 $this->output( "Bot passwords invalidated for " . $user->getName() . "\n" );
37 } else {
38 $this->output( "No bot passwords invalidated for " . $user->getName() . "\n" );
39 }
40 }
41}
42
43// @codeCoverageIgnoreStart
44$maintClass = InvalidateBotPasswords::class;
45require_once RUN_MAINTENANCE_IF_MAIN;
46// @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.