Merge "objectcache: add "staleTTL" into WANObjectCache::getWithSetCallback()"
[lhc/web/wiklou.git] / maintenance / populateIpChanges.php
index 2b2a2b4..178c49a 100644 (file)
@@ -78,7 +78,7 @@ 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' ],
@@ -110,14 +110,11 @@ TEXT
                                }
                        }
 
-                       $dbw->insert(
-                               'ip_changes',
-                               $insertRows,
-                               __METHOD__,
-                               'IGNORE'
-                       );
+                       if ( $insertRows ) {
+                               $dbw->insert( 'ip_changes', $insertRows, __METHOD__, 'IGNORE' );
 
-                       $inserted += $dbw->affectedRows();
+                               $inserted += $dbw->affectedRows();
+                       }
 
                        $lbFactory->waitForReplication();
                        usleep( $throttle * 1000 );