7 $optionsWithArgs = array( 'maxjobs', 'type' );
8 $wgUseNormalUser = true;
9 require_once( 'commandLine.inc' );
10 require_once( "$IP/includes/JobQueue.php" );
11 require_once( "$IP/includes/FakeTitle.php" );
13 if ( isset( $options['maxjobs'] ) ) {
14 $maxJobs = $options['maxjobs'];
20 if ( isset( $options['type'] ) )
21 $type = $options['type'];
23 $wgTitle = Title
::newFromText( 'RunJobs.php' );
25 $dbw = wfGetDB( DB_MASTER
);
29 $conds = "job_cmd = " . $dbw->addQuotes($type);
31 while ( $dbw->selectField( 'job', 'count(*)', $conds, 'runJobs.php' ) ) {
34 $job = ($type == false) ?
36 : Job
::pop_type($type);
42 print wfTimestamp( TS_DB
) . " " . $job->id
. " " . $job->toString() . "\n";
45 print wfTimestamp( TS_DB
) . " Error: {$job->error}\n";
47 if ( $maxJobs && ++
$n > $maxJobs ) {