MediaWiki master
invalidateBotPasswords.php
Go to the documentation of this file.
1<?php
25
26// @codeCoverageIgnoreStart
27require_once __DIR__ . '/Maintenance.php';
28// @codeCoverageIgnoreEnd
29
36 public function __construct() {
37 parent::__construct();
38 $this->addOption( "user", "The username to operate on", false, true );
39 $this->addOption( "userid", "The user id to operate on", false, true );
40 $this->addDescription( "Invalidate a user's bot passwords" );
41 }
42
43 public function execute() {
44 $user = $this->validateUserOption( "A \"user\" or \"userid\" must be set to invalidate the bot passwords for" );
45
46 $res = BotPassword::invalidateAllPasswordsForUser( $user->getName() );
47
48 if ( $res ) {
49 $this->output( "Bot passwords invalidated for " . $user->getName() . "\n" );
50 } else {
51 $this->output( "No bot passwords invalidated for " . $user->getName() . "\n" );
52 }
53 }
54}
55
56// @codeCoverageIgnoreStart
57$maintClass = InvalidateBotPasswords::class;
58require_once RUN_MAINTENANCE_IF_MAIN;
59// @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.
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.