Index: trunk/extensions/CheckUser/install.php |
— | — | @@ -18,8 +18,10 @@ |
19 | 19 | create_cu_changes( $db, $cutoff ); |
20 | 20 | |
21 | 21 | function create_cu_changes( $db, $cutoff = null ) { |
| 22 | + global $wgDBtype; |
22 | 23 | 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 ); |
24 | 26 | } |
25 | 27 | |
26 | 28 | if( $cutoff ) { |
— | — | @@ -37,7 +39,7 @@ |
38 | 40 | $end = $db->selectField( 'recentchanges', 'MAX(rc_id)', false, __FUNCTION__ ); |
39 | 41 | $blockStart = $start; |
40 | 42 | $blockEnd = $start + BATCH_SIZE - 1; |
41 | | - while ( $blockEnd <= $end ) { |
| 43 | + while ( $blockStart <= $end ) { |
42 | 44 | $cond = "rc_id BETWEEN $blockStart AND $blockEnd $cutoffCond"; |
43 | 45 | $res = $db->select( 'recentchanges', '*', $cond, __FUNCTION__ ); |
44 | 46 | $batch = array(); |
— | — | @@ -63,8 +65,10 @@ |
64 | 66 | } |
65 | 67 | $blockStart += BATCH_SIZE; |
66 | 68 | $blockEnd += BATCH_SIZE; |
67 | | - wfWaitForSlaves( 5 ); |
| 69 | + if ( function_exists ( 'wgWaitForSlaves' ) ) |
| 70 | + wfWaitForSlaves( 5 ); |
68 | 71 | } |
| 72 | + $db->commit(); |
69 | 73 | } |
70 | 74 | |
71 | 75 | ?> |