From: MusikAnimal Date: Tue, 5 Sep 2017 21:21:55 +0000 (-0400) Subject: Fix maintenance script that populates the ip_changes table X-Git-Tag: 1.31.0-rc.0~2206 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=159a34bc50d367debce16bca5dd9cb2dff236e6c;p=lhc%2Fweb%2Fwiklou.git Fix maintenance script that populates the ip_changes table Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e065 --- diff --git a/maintenance/populateIpChanges.php b/maintenance/populateIpChanges.php index 7a8bfc43e5..eb60f801cd 100644 --- a/maintenance/populateIpChanges.php +++ b/maintenance/populateIpChanges.php @@ -67,7 +67,7 @@ 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; + $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' ], @@ -79,27 +79,27 @@ 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++;