X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FresetUserTokens.php;h=284db2c22e70a53003c192b7741ed9a571c70f26;hb=899f475d0dad8ea0a24f706fc8ac07e3097d6191;hp=08be553773e9003c1de74b6a12e58254929c8514;hpb=0bd709dac68652cbb1b06a7c5176e7a4978e1c02;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/resetUserTokens.php b/maintenance/resetUserTokens.php index 08be553773..284db2c22e 100644 --- a/maintenance/resetUserTokens.php +++ b/maintenance/resetUserTokens.php @@ -30,12 +30,15 @@ require_once __DIR__ . '/Maintenance.php'; * 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->mDescription = - "Reset the user_token of all users on the wiki. Note that this may log some of them out."; + $this->addDescription( + "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( 'nulls', @@ -61,31 +64,31 @@ class ResetUserTokens extends Maintenance { $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 = wfGetDB( DB_SLAVE ); + // We list user by user_id from one of the replica DBs + $dbr = $this->getDB( DB_REPLICA ); - $where = array(); + $where = []; if ( $this->nullsOnly ) { // Have to build this by hand, because \ is escaped in helper functions - $where = array( 'user_token = \'' . str_repeat( '\0', 32 ) . '\'' ); + $where = [ 'user_token = \'' . str_repeat( '\0', 32 ) . '\'' ]; } - $maxid = $dbr->selectField( 'user', 'MAX(user_id)', array(), __METHOD__ ); + $maxid = $dbr->selectField( 'user', 'MAX(user_id)', [], __METHOD__ ); $min = 0; - $max = $this->mBatchSize; + $max = $this->getBatchSize(); do { $result = $dbr->select( 'user', - array( 'user_id' ), + [ 'user_id' ], array_merge( $where, - array( 'user_id > ' . $dbr->addQuotes( $min ), + [ 'user_id > ' . $dbr->addQuotes( $min ), 'user_id <= ' . $dbr->addQuotes( $max ) - ) + ] ), __METHOD__ ); @@ -95,7 +98,7 @@ class ResetUserTokens extends Maintenance { } $min = $max; - $max = $min + $this->mBatchSize; + $max = $min + $this->getBatchSize(); wfWaitForSlaves(); } while ( $min <= $maxid ); @@ -112,5 +115,5 @@ class ResetUserTokens extends Maintenance { } } -$maintClass = "ResetUserTokens"; +$maintClass = ResetUserTokens::class; require_once RUN_MAINTENANCE_IF_MAIN;