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