The war on redundant ampersand usage!
[lhc/web/wiklou.git] / maintenance / runJobs.php
1 <?php
2
3 $optionsWithArgs = array( 'maxjobs' );
4 $wgUseNormalUser = true;
5 require_once( 'commandLine.inc' );
6 require_once( "$IP/includes/JobQueue.php" );
7 require_once( "$IP/includes/FakeTitle.php" );
8
9 if ( isset( $options['maxjobs'] ) ) {
10 $maxJobs = $options['maxjobs'];
11 } else {
12 $maxJobs = 10000;
13 }
14
15 $wgTitle = Title::newFromText( 'RunJobs.php' );
16
17 $dbw = wfGetDB( DB_MASTER );
18 $n = 0;
19 while ( $dbw->selectField( 'job', 'count(*)', '', 'runJobs.php' ) ) {
20 while ( false != ($job = Job::pop()) ) {
21 wfWaitForSlaves( 5 );
22 print $job->id . " " . $job->toString() . "\n";
23 if ( !$job->run() ) {
24 print "Error: {$job->error}\n";
25 }
26 if ( $maxJobs && ++$n > $maxJobs ) {
27 break 2;
28 }
29 }
30 }
31 ?>