(bug 8701) Check database lock status when blocking/unblocking users
[mediawiki.git] / maintenance / runJobs.php
blob530a406337c5f77a0178102aeaaf50989888de94
1 <?php
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" );
9 if ( isset( $options['maxjobs'] ) ) {
10 $maxJobs = $options['maxjobs'];
11 } else {
12 $maxJobs = 10000;
15 $wgTitle = Title::newFromText( 'RunJobs.php' );
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";
26 if ( $maxJobs && ++$n > $maxJobs ) {
27 break 2;