31require_once __DIR__ .
'/Maintenance.php';
40 parent::__construct();
42 $this->
addArg(
'user',
'Username or user ID, if starts with #',
true );
47 $userName = $this->
getArg( 0 );
48 if ( preg_match(
'/^#\d+$/', $userName ) ) {
49 $user = $userFactory->newFromId( (
int)substr( $userName, 1 ) );
51 $user = $userFactory->newFromName( $userName );
55 if ( !$user || !$user->isRegistered() || !$user->loadFromId() ) {
56 $this->
fatalError(
"Error: user '$userName' could not be loaded" );
60 $user->invalidateEmail();
61 $user->saveSettings();
62 $this->
output(
"Done!\n" );
68require_once RUN_MAINTENANCE_IF_MAIN;
execute()
Do the actual work.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true, $multi=false)
Add some args that are needed.
getArg( $argId=0, $default=null)
Get an argument.
output( $out, $channel=null)
Throw some output to the user.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
getServiceContainer()
Returns the main service container.
addDescription( $text)
Set the description text.