r35124 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35123‎ | r35124 | r35125 >
Date:01:24, 21 May 2008
Author:aaron
Status:old
Tags:
Comment:
Remove shitty BATCH_SIZE constant, and use a variable
Modified paths:
  • /trunk/extensions/FlaggedRevs/maintenance/updateAutoPromote.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/updateAutoPromote.inc
@@ -1,11 +1,13 @@
22 <?php
33
4 -define( 'BATCH_SIZE', 25 );
5 -
64 function update_autopromote() {
75 global $wgContentNamespaces, $wgFlaggedRevsAutopromote;
86 echo "Populating and updating autopromote table\n";
 7+
 8+ $BATCH_SIZE = 25;
 9+
910 $db = wfGetDB( DB_SLAVE );
 11+
1012 $start = $db->selectField( 'user', 'MIN(user_id)', false, __FUNCTION__ );
1113 $end = $db->selectField( 'user', 'MAX(user_id)', false, __FUNCTION__ );
1214 if( is_null( $start ) || is_null( $end ) ){
@@ -13,9 +15,9 @@
1416 return;
1517 }
1618 # Do remaining chunk
17 - $end += BATCH_SIZE - 1;
 19+ $end += $BATCH_SIZE - 1;
1820 $blockStart = $start;
19 - $blockEnd = $start + BATCH_SIZE - 1;
 21+ $blockEnd = $start + $BATCH_SIZE - 1;
2022 $count = 0;
2123 $changed = 0;
2224 while( $blockEnd <= $end ) {
@@ -64,8 +66,8 @@
6567 $count++;
6668 }
6769 $db->freeResult( $res );
68 - $blockStart += BATCH_SIZE - 1;
69 - $blockEnd += BATCH_SIZE - 1;
 70+ $blockStart += $BATCH_SIZE - 1;
 71+ $blockEnd += $BATCH_SIZE - 1;
7072 wfWaitForSlaves( 5 );
7173 }
7274 echo "autopromote table update complete ... {$count} rows [{$changed} changed or added]\n";

Status & tagging log