X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateIpChanges.php;h=ffb8c43b300cfe3f41f45ea8255e8616180f83f3;hb=16068520c1115085af34f1aebf4ae441a056ecee;hp=eb60f801cda164988dedada862b35b0288645a9f;hpb=159a34bc50d367debce16bca5dd9cb2dff236e6c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateIpChanges.php b/maintenance/populateIpChanges.php index eb60f801cd..ffb8c43b30 100644 --- a/maintenance/populateIpChanges.php +++ b/maintenance/populateIpChanges.php @@ -67,12 +67,12 @@ TEXT $this->output( "Copying IP revisions to ip_changes, from rev_id $start to rev_id $end\n" ); while ( $blockStart <= $end ) { - $cond = "rev_id >= $blockStart AND rev_user = 0 ORDER BY rev_id ASC LIMIT " . $this->mBatchSize; $rows = $dbw->select( 'revision', [ 'rev_id', 'rev_timestamp', 'rev_user_text' ], - $cond, - __METHOD__ + [ "rev_id >= $blockStart", 'rev_user' => 0 ], + __METHOD__, + [ 'ORDER BY' => 'rev_id ASC', 'LIMIT' => $this->mBatchSize ] ); if ( !$rows || $rows->numRows() === 0 ) { @@ -82,19 +82,15 @@ TEXT $this->output( "...checking $this->mBatchSize revisions for IP edits that need copying, " . "starting with rev_id $blockStart\n" ); + $insertRows = []; foreach ( $rows as $row ) { // Double-check to make sure this is an IP, e.g. not maintenance user or imported revision. if ( IP::isValid( $row->rev_user_text ) ) { - $dbw->insert( - 'ip_changes', - [ - 'ipc_rev_id' => $row->rev_id, - 'ipc_rev_timestamp' => $row->rev_timestamp, - 'ipc_hex' => IP::toHex( $row->rev_user_text ), - ], - __METHOD__, - 'IGNORE' - ); + $insertRows[] = [ + 'ipc_rev_id' => $row->rev_id, + 'ipc_rev_timestamp' => $row->rev_timestamp, + 'ipc_hex' => IP::toHex( $row->rev_user_text ), + ]; $revCount++; } @@ -104,6 +100,13 @@ TEXT $blockStart++; + $dbw->insert( + 'ip_changes', + $insertRows, + __METHOD__, + 'IGNORE' + ); + $lbFactory->waitForReplication(); usleep( $throttle * 1000 ); }