*/ require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class ResetUserTokens extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Reset the user_token of all users on the wiki. Note that this may log some of them out."; $this->addOption( 'nowarn', "Hides the 5 seconds warning", false, false ); $this->addOption( 'quiet', "Do not print what is happening", false, false ); } public function execute() { $nowarn = $this->getOption( 'nowarn' ); $quiet = $this->getOption( 'quiet' ); if ( !$nowarn ) { echo <<select( 'user', array( 'user_id' ), array(), __METHOD__ ); foreach ( $result as $id ) { $user = User::newFromId( $id->user_id ); $username = $user->getName(); if ( !$quiet ) { echo "Resetting user_token for $username: "; } // Change value $user->setToken(); $user->saveSettings(); if ( !$quiet ) { echo " OK\n"; } } } } $maintClass = "ResetUserTokens"; require_once( RUN_MAINTENANCE_IF_MAIN );