CSteipp has uploaded a new change for review. https://gerrit.wikimedia.org/r/124793
Change subject: Add min/max to reset token script ...................................................................... Add min/max to reset token script Allow parallel running of scripts by gu_id offset, to hopefully speed this up. Change-Id: I184b811e9e5b9fcbcdb6c06ebcbe002b3606ce75 --- M maintenance/resetGlobalUserTokens.php 1 file changed, 15 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth refs/changes/93/124793/1 diff --git a/maintenance/resetGlobalUserTokens.php b/maintenance/resetGlobalUserTokens.php index 7391ea9..e0eb354 100644 --- a/maintenance/resetGlobalUserTokens.php +++ b/maintenance/resetGlobalUserTokens.php @@ -41,6 +41,8 @@ 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( 'minid', "Start processing after this gu_id, default is 0", false, true ); + $this->addOption( 'maxid', "Stop processing after this gu_id, default is MAX(gu_id) in globalusers", false, true ); $this->setBatchSize( 1000 ); } @@ -57,22 +59,19 @@ // We list user by user_id from one of the slave database $dbr = CentralAuthUser::getCentralDB( DB_SLAVE ); + $maxid = $this->getOption( 'maxid', -1 ); - $where = array(); - - $maxid = $dbr->selectField( 'globaluser', 'MAX(gu_id)', array(), __METHOD__ ); - - $min = 0; - $max = $this->mBatchSize; + if ( $maxid == -1 ) { + $maxid = $dbr->selectField( 'globaluser', 'MAX(gu_id)', array(), __METHOD__ ); + } + $min = $this->getOption( 'minid', 0 ); + $max = $min + $this->mBatchSize; do { $result = $dbr->select( 'globaluser', array( 'gu_id', 'gu_name' ), - array_merge( - $where, - array( 'gu_id > ' . $dbr->addQuotes( $min ), - 'gu_id <= ' . $dbr->addQuotes( $max ) - ) + array( 'gu_id > ' . $dbr->addQuotes( $min ), + 'gu_id <= ' . $dbr->addQuotes( $max ) ), __METHOD__ ); @@ -84,9 +83,13 @@ $min = $max; $max = $min + $this->mBatchSize; + if ( $max > $maxid ) { + $max = $maxid; + } + wfWaitForSlaves(); - } while ( $min <= $maxid ); + } while ( $min < $maxid ); } -- To view, visit https://gerrit.wikimedia.org/r/124793 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I184b811e9e5b9fcbcdb6c06ebcbe002b3606ce75 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralAuth Gerrit-Branch: master Gerrit-Owner: CSteipp <cste...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits