X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FpopulateIpChanges.php;h=216582086ca79c2b12e7f2e1398503cd5dbdb7bf;hp=40a596c8f2ca74789a81c6c03312a6ec9840c41d;hb=08edb27f6ce31c676660a4ef89b87da79bde2cc2;hpb=5fa4cdf860c79b32ab6ef034c6d9420c2727f695 diff --git a/maintenance/populateIpChanges.php b/maintenance/populateIpChanges.php index 40a596c8f2..216582086c 100644 --- a/maintenance/populateIpChanges.php +++ b/maintenance/populateIpChanges.php @@ -62,9 +62,14 @@ TEXT } public function doDBUpdates() { + $dbw = $this->getDB( DB_MASTER ); + + if ( !$dbw->tableExists( 'ip_changes' ) ) { + $this->fatalError( 'ip_changes table does not exist' ); + } + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] ); - $dbw = $this->getDB( DB_MASTER ); $throttle = intval( $this->getOption( 'throttle', 0 ) ); $maxRevId = intval( $this->getOption( 'max-rev-id', 0 ) ); $start = $this->getOption( 'rev-id', 0 ); @@ -78,11 +83,11 @@ TEXT $this->output( "Copying IP revisions to ip_changes, from rev_id $start to rev_id $end\n" ); while ( $blockStart <= $end ) { - $blockEnd = min( $blockStart + $this->mBatchSize, $end ); + $blockEnd = min( $blockStart + $this->getBatchSize(), $end ); $rows = $dbr->select( 'revision', [ 'rev_id', 'rev_timestamp', 'rev_user_text' ], - [ "rev_id BETWEEN $blockStart AND $blockEnd", 'rev_user' => 0 ], + [ "rev_id BETWEEN " . (int)$blockStart . " AND " . (int)$blockEnd, 'rev_user' => 0 ], __METHOD__ );