r35129 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35128‎ | r35129 | r35130 >
Date:03:08, 21 May 2008
Author:aaron
Status:old
Tags:
Comment:
Use $BATCH_SIZE
Modified paths:
  • /trunk/extensions/FlaggedRevs/maintenance/reviewAllPages.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/reviewAllPages.inc
@@ -1,7 +1,5 @@
22 <?php
33
4 -define( 'BATCH_SIZE', 50 );
5 -
64 function autoreview_current( $user, $db ) {
75 global $wgFlaggedRevsNamespaces;
86 echo "Auto-reviewing all current page versions...\n";
@@ -9,6 +7,7 @@
108 echo( "Invalid user specified!" );
119 exit(0);
1210 }
 11+ $BATCH_SIZE = 50;
1312 $start = $db->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ );
1413 $end = $db->selectField( 'page', 'MAX(page_id)', false, __FUNCTION__ );
1514 if( is_null( $start ) || is_null( $end ) ){
@@ -16,9 +15,9 @@
1716 return;
1817 }
1918 # Do remaining chunk
20 - $end += BATCH_SIZE - 1;
 19+ $end += $BATCH_SIZE - 1;
2120 $blockStart = $start;
22 - $blockEnd = $start + BATCH_SIZE - 1;
 21+ $blockEnd = $start + $BATCH_SIZE - 1;
2322 $count = 0;
2423 $changed = 0;
2524 while( $blockEnd <= $end ) {
@@ -48,8 +47,8 @@
4948 $count++;
5049 }
5150 $db->freeResult( $res );
52 - $blockStart += BATCH_SIZE - 1;
53 - $blockEnd += BATCH_SIZE - 1;
 51+ $blockStart += $BATCH_SIZE - 1;
 52+ $blockEnd += $BATCH_SIZE - 1;
5453 wfWaitForSlaves( 5 );
5554 }
5655 echo "Auto-reviewing of all pages complete ... {$count} rows [{$changed} changed]\n";

Status & tagging log