X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FresetUserTokens.php;h=481da980da02e0a8074a801b304afa0ec08602c0;hb=ef50d30b7b8e3b6f8480b74135f2f2e30f479336;hp=7acf9759a173503a43a183a92c4610197f530285;hpb=f132746d2882a8383cb6288325aae048b2b996e3;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/resetUserTokens.php b/maintenance/resetUserTokens.php index 7acf9759a1..481da980da 100644 --- a/maintenance/resetUserTokens.php +++ b/maintenance/resetUserTokens.php @@ -30,12 +30,14 @@ 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->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( @@ -65,28 +67,29 @@ class ResetUserTokens extends Maintenance { wfCountDown( 5 ); } + // We list user by user_id from one of the replica DBs // We list user by user_id from one of the slave database - $dbr = $this->getDB( DB_SLAVE ); + $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; 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__ );