Index: trunk/extensions/DumpHTML/dumpHTML.inc |
— | — | @@ -3,10 +3,11 @@ |
4 | 4 | * @file |
5 | 5 | * @ingroup Maintenance |
6 | 6 | */ |
| 7 | +class DumpHTML { |
7 | 8 | |
8 | | -define( 'REPORTING_INTERVAL', 10 ); |
| 9 | + # How often to report something to the user |
| 10 | + const REPORTING_INTERVAL = 10; |
9 | 11 | |
10 | | -class DumpHTML { |
11 | 12 | # Destination directory |
12 | 13 | var $dest; |
13 | 14 | |
— | — | @@ -193,11 +194,11 @@ |
194 | 195 | |
195 | 196 | for ( $id = $start, $i = 0; $id <= $end; $id += $this->sliceDenominator, $i++ ) { |
196 | 197 | wfWaitForSlaves( 20 ); |
197 | | - if ( !( $i % REPORTING_INTERVAL) ) { |
| 198 | + if ( !( $i % self::REPORTING_INTERVAL) ) { |
198 | 199 | print "Processing ID: $id\r"; |
199 | 200 | $this->setCheckpoint( 'article', $id ); |
200 | 201 | } |
201 | | - if ( !($i % (REPORTING_INTERVAL*10) ) ) { |
| 202 | + if ( !($i % (self::REPORTING_INTERVAL*10) ) ) { |
202 | 203 | print "\n"; |
203 | 204 | } |
204 | 205 | $title = Title::newFromID( $id ); |
— | — | @@ -293,7 +294,7 @@ |
294 | 295 | } |
295 | 296 | |
296 | 297 | wfWaitForSlaves( 10 ); |
297 | | - if ( !( ++$i % REPORTING_INTERVAL ) ) { |
| 298 | + if ( !( ++$i % self::REPORTING_INTERVAL ) ) { |
298 | 299 | print "{$row->img_name}\n"; |
299 | 300 | if ( $row->img_name !== 'done' ) { |
300 | 301 | $this->setCheckpoint( 'local image', $row->img_name ); |
— | — | @@ -343,7 +344,7 @@ |
344 | 345 | if ( $file[0] == '.' ) { |
345 | 346 | continue; |
346 | 347 | } |
347 | | - if ( !(++$i % REPORTING_INTERVAL ) ) { |
| 348 | + if ( !(++$i % self::REPORTING_INTERVAL ) ) { |
348 | 349 | print "$rel $i\r"; |
349 | 350 | } |
350 | 351 | |
— | — | @@ -398,7 +399,7 @@ |
399 | 400 | } |
400 | 401 | |
401 | 402 | wfWaitForSlaves( 10 ); |
402 | | - if ( !(++$i % REPORTING_INTERVAL ) ) { |
| 403 | + if ( !(++$i % self::REPORTING_INTERVAL ) ) { |
403 | 404 | print "{$row->cl_to}\n"; |
404 | 405 | if ( $row->cl_to != 'done' ) { |
405 | 406 | $this->setCheckpoint( 'category', $row->cl_to ); |
— | — | @@ -451,7 +452,7 @@ |
452 | 453 | |
453 | 454 | while ( $row = $dbr->fetchObject( $res ) ) { |
454 | 455 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
455 | | - if ( !(++$i % (REPORTING_INTERVAL*10) ) ) { |
| 456 | + if ( !(++$i % (self::REPORTING_INTERVAL*10) ) ) { |
456 | 457 | printf( "Done %d redirects (%2.3f%%)\n", $i, $row->page_id / $end * 100 ); |
457 | 458 | $this->setCheckpoint( 'redirect', $row->page_id ); |
458 | 459 | } |