$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;
+ $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' ],
break;
}
- $this->output( "...copying $this->mBatchSize revisions starting with rev_id $blockStart\n" );
+ $this->output( "...checking $this->mBatchSize revisions for IP edits that need copying, " .
+ "starting with rev_id $blockStart\n" );
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 ) ) {
- continue;
+ 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'
+ );
+
+ $revCount++;
}
- $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'
- );
-
$blockStart = (int)$row->rev_id;
- $revCount++;
}
$blockStart++;