jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/376136 )

Change subject: Fix maintenance script that populates the ip_changes table
......................................................................


Fix maintenance script that populates the ip_changes table

Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e065
---
M maintenance/populateIpChanges.php
1 file changed, 16 insertions(+), 16 deletions(-)

Approvals:
  MaxSem: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/populateIpChanges.php 
b/maintenance/populateIpChanges.php
index 7a8bfc4..eb60f80 100644
--- a/maintenance/populateIpChanges.php
+++ b/maintenance/populateIpChanges.php
@@ -67,7 +67,7 @@
                $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 @@
                                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++;

-- 
To view, visit https://gerrit.wikimedia.org/r/376136
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e065
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MusikAnimal <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to