* Maintenance script to reset the user_token for all users on the wiki.
*
* @ingroup Maintenance
+ * @deprecated since 1.27, use $wgAuthenticationTokenVersion instead.
*/
class ResetUserTokens extends Maintenance {
public function __construct() {
parent::__construct();
$this->addDescription(
- 'Reset the user_token of all users on the wiki. Note that this may log some of them out.'
+ "Reset the user_token of all users on the wiki. Note that this may log some of them out.\n"
+ . "Deprecated, use \$wgAuthenticationTokenVersion instead."
);
$this->addOption( 'nowarn', "Hides the 5 seconds warning", false, false );
$this->addOption(
$this->output( "\n" );
$this->output( "Abort with control-c in the next five seconds "
. "(skip this countdown with --nowarn) ... " );
- wfCountDown( 5 );
+ $this->countDown( 5 );
}
- // We list user by user_id from one of the slave database
- $dbr = $this->getDB( DB_SLAVE );
+ // We list user by user_id from one of the replica DBs
+ $dbr = $this->getDB( DB_REPLICA );
$where = [];
if ( $this->nullsOnly ) {
$maxid = $dbr->selectField( 'user', 'MAX(user_id)', [], __METHOD__ );
$min = 0;
- $max = $this->mBatchSize;
+ $max = $this->getBatchSize();
do {
$result = $dbr->select( 'user',
}
$min = $max;
- $max = $min + $this->mBatchSize;
+ $max = $min + $this->getBatchSize();
wfWaitForSlaves();
} while ( $min <= $maxid );
}
}
-$maintClass = "ResetUserTokens";
+$maintClass = ResetUserTokens::class;
require_once RUN_MAINTENANCE_IF_MAIN;