X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FresetUserTokens.php;h=837f304ddcda8592a8a476421675cbfd550b42b4;hb=1c80fe572eec7610f35c87e0a43e49d886193d58;hp=08be553773e9003c1de74b6a12e58254929c8514;hpb=7bbc880626c92055f1ff22deb90d132f8f766160;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/resetUserTokens.php b/maintenance/resetUserTokens.php index 08be553773..837f304ddc 100644 --- a/maintenance/resetUserTokens.php +++ b/maintenance/resetUserTokens.php @@ -34,8 +34,9 @@ require_once __DIR__ . '/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->addDescription( + '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( 'nulls', @@ -65,27 +66,27 @@ class ResetUserTokens extends Maintenance { } // We list user by user_id from one of the slave database - $dbr = wfGetDB( DB_SLAVE ); + $dbr = $this->getDB( DB_SLAVE ); - $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__ );