blob: 4539be054d22fa936ec05608c9f2eb4445827b0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
$optionsWithArgs = array( 'maxjobs' );
$wgUseNormalUser = true;
require_once( 'commandLine.inc' );
require_once( "$IP/includes/JobQueue.php" );
require_once( "$IP/includes/FakeTitle.php" );
if ( isset( $options['maxjobs'] ) ) {
$maxJobs = $options['maxjobs'];
} else {
$maxJobs = 10000;
}
$type = false;
if ( isset( $options['type'] ) )
$type = $options['type'];
$wgTitle = Title::newFromText( 'RunJobs.php' );
$dbw = wfGetDB( DB_MASTER );
$n = 0;
$conds = array();
if ($type !== false)
$conds = array('job_cmd' => $type);
while ( $dbw->selectField( 'job', 'count(*)', $conds, 'runJobs.php' ) ) {
$offset=0;
for (;;) {
$job = ($type == false) ?
Job::pop($offset, $type)
: Job::pop_type($type);
if ($job == false)
break;
wfWaitForSlaves( 5 );
print $job->id . " " . $job->toString() . "\n";
$offset=$job->id;
if ( !$job->run() ) {
print "Error: {$job->error}\n";
}
if ( $maxJobs && ++$n > $maxJobs ) {
break 2;
}
}
}
|