dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Introduce Maintenance::getBatchSize()"
[lhc/web/wiklou.git]
/
maintenance
/
populateIpChanges.php
diff --git
a/maintenance/populateIpChanges.php
b/maintenance/populateIpChanges.php
index
f7bcc12
..
178c49a
100644
(file)
--- a/
maintenance/populateIpChanges.php
+++ b/
maintenance/populateIpChanges.php
@@
-72,12
+72,13
@@
TEXT
? $maxRevId
: $dbw->selectField( 'revision', 'MAX(rev_id)', false, __METHOD__ );
$blockStart = $start;
? $maxRevId
: $dbw->selectField( 'revision', 'MAX(rev_id)', false, __METHOD__ );
$blockStart = $start;
- $revCount = 0;
+ $attempted = 0;
+ $inserted = 0;
$this->output( "Copying IP revisions to ip_changes, from rev_id $start to rev_id $end\n" );
while ( $blockStart <= $end ) {
$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' ],
$rows = $dbr->select(
'revision',
[ 'rev_id', 'rev_timestamp', 'rev_user_text' ],
@@
-105,16
+106,15
@@
TEXT
'ipc_hex' => IP::toHex( $row->rev_user_text ),
];
'ipc_hex' => IP::toHex( $row->rev_user_text ),
];
- $
revCount
++;
+ $
attempted
++;
}
}
}
}
- $dbw->insert(
- 'ip_changes',
- $insertRows,
- __METHOD__,
- 'IGNORE'
- );
+ if ( $insertRows ) {
+ $dbw->insert( 'ip_changes', $insertRows, __METHOD__, 'IGNORE' );
+
+ $inserted += $dbw->affectedRows();
+ }
$lbFactory->waitForReplication();
usleep( $throttle * 1000 );
$lbFactory->waitForReplication();
usleep( $throttle * 1000 );
@@
-122,7
+122,7
@@
TEXT
$blockStart = $blockEnd + 1;
}
$blockStart = $blockEnd + 1;
}
- $this->output( "
$revCount IP revisions copied
.\n" );
+ $this->output( "
Attempted to insert $attempted IP revisions, $inserted actually done
.\n" );
return true;
}
return true;
}