r21708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21707‎ | r21708 | r21709 >
Date:02:16, 30 April 2007
Author:greg
Status:old
Tags:
Comment:
Load alternate sql file when using Postgres.
Make sure we check that blockStart, not blockEnd, is <= end.
Check for wgWaitForSlaves function before calling.
Commit at end.
Modified paths:
  • /trunk/extensions/CheckUser/install.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/install.php
@@ -18,8 +18,10 @@
1919 create_cu_changes( $db, $cutoff );
2020
2121 function create_cu_changes( $db, $cutoff = null ) {
 22+ global $wgDBtype;
2223 if( !$db->tableExists( 'cu_changes' ) ) {
23 - $db->sourceFile( dirname( __FILE__ ) . '/cu_changes.sql' );
 24+ $sourcefile = $wgDBtype === 'postgres' ? '/cu_changes.pg.sql' : '/cu_changes.sql';
 25+ $db->sourceFile( dirname( __FILE__ ) . $sourcefile );
2426 }
2527
2628 if( $cutoff ) {
@@ -37,7 +39,7 @@
3840 $end = $db->selectField( 'recentchanges', 'MAX(rc_id)', false, __FUNCTION__ );
3941 $blockStart = $start;
4042 $blockEnd = $start + BATCH_SIZE - 1;
41 - while ( $blockEnd <= $end ) {
 43+ while ( $blockStart <= $end ) {
4244 $cond = "rc_id BETWEEN $blockStart AND $blockEnd $cutoffCond";
4345 $res = $db->select( 'recentchanges', '*', $cond, __FUNCTION__ );
4446 $batch = array();
@@ -63,8 +65,10 @@
6466 }
6567 $blockStart += BATCH_SIZE;
6668 $blockEnd += BATCH_SIZE;
67 - wfWaitForSlaves( 5 );
 69+ if ( function_exists ( 'wgWaitForSlaves' ) )
 70+ wfWaitForSlaves( 5 );
6871 }
 72+ $db->commit();
6973 }
7074
7175 ?>

Follow-up revisions

RevisionCommit summaryAuthorDate
r21709*Typo from r21708aaron04:16, 30 April 2007