MediaWiki REL1_31
disableOATHAuthForUser.php
Go to the documentation of this file.
1<?php
2
3if ( getenv( 'MW_INSTALL_PATH' ) ) {
4 $IP = getenv( 'MW_INSTALL_PATH' );
5} else {
6 $IP = __DIR__ . '/../../..';
7}
8require_once "$IP/maintenance/Maintenance.php";
9
11 function __construct() {
12 parent::__construct();
13 $this->mDescription = 'Remove OATHAuth from a specific user';
14 $this->addArg( 'user', 'The username to remove OATHAuth from.' );
15 $this->requireExtension( 'OATHAuth' );
16 }
17
18 public function execute() {
19 $username = $this->getArg( 0 );
20
22 if ( $user && $user->getId() === 0 ) {
23 $this->error( "User $username doesn't exist!", 1 );
24 }
25
27
28 $oathUser = $repo->findByUser( $user );
29
30 if ( $oathUser->getKey() === null ) {
31 $this->error( "User $username doesn't have OATHAuth enabled!", 1 );
32 }
33
34 $repo->remove( $oathUser );
35 $this->output( "OATHAuth disabled for $username.\n" );
36 }
37}
38
39$maintClass = "DisableOATHAuthForUser";
40require_once RUN_MAINTENANCE_IF_MAIN;
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true)
Add some args that are needed.
requireExtension( $name)
Indicate that the specified extension must be loaded before the script can run.
getArg( $argId=0, $default=null)
Get an argument.
static getOATHUserRepository()
Get the singleton OATH user repository.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition User.php:591
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
Definition hooks.txt:2612
this hook is for auditing only or null if authentication failed before getting that far $username
Definition hooks.txt:785
$IP
Definition update.php:3
require_once RUN_MAINTENANCE_IF_MAIN