Index: trunk/extensions/FlaggedRevs/maintenance/updateAutoPromote.inc |
— | — | @@ -1,11 +1,13 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -define( 'BATCH_SIZE', 25 ); |
5 | | - |
6 | 4 | function update_autopromote() { |
7 | 5 | global $wgContentNamespaces, $wgFlaggedRevsAutopromote; |
8 | 6 | echo "Populating and updating autopromote table\n"; |
| 7 | + |
| 8 | + $BATCH_SIZE = 25; |
| 9 | + |
9 | 10 | $db = wfGetDB( DB_SLAVE ); |
| 11 | + |
10 | 12 | $start = $db->selectField( 'user', 'MIN(user_id)', false, __FUNCTION__ ); |
11 | 13 | $end = $db->selectField( 'user', 'MAX(user_id)', false, __FUNCTION__ ); |
12 | 14 | if( is_null( $start ) || is_null( $end ) ){ |
— | — | @@ -13,9 +15,9 @@ |
14 | 16 | return; |
15 | 17 | } |
16 | 18 | # Do remaining chunk |
17 | | - $end += BATCH_SIZE - 1; |
| 19 | + $end += $BATCH_SIZE - 1; |
18 | 20 | $blockStart = $start; |
19 | | - $blockEnd = $start + BATCH_SIZE - 1; |
| 21 | + $blockEnd = $start + $BATCH_SIZE - 1; |
20 | 22 | $count = 0; |
21 | 23 | $changed = 0; |
22 | 24 | while( $blockEnd <= $end ) { |
— | — | @@ -64,8 +66,8 @@ |
65 | 67 | $count++; |
66 | 68 | } |
67 | 69 | $db->freeResult( $res ); |
68 | | - $blockStart += BATCH_SIZE - 1; |
69 | | - $blockEnd += BATCH_SIZE - 1; |
| 70 | + $blockStart += $BATCH_SIZE - 1; |
| 71 | + $blockEnd += $BATCH_SIZE - 1; |
70 | 72 | wfWaitForSlaves( 5 ); |
71 | 73 | } |
72 | 74 | echo "autopromote table update complete ... {$count} rows [{$changed} changed or added]\n"; |