summaryrefslogtreecommitdiff
path: root/maintenance/showJobs.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
commit08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch)
tree577a29fb579188d16003a209ce2a2e9c5b0aa2bd /maintenance/showJobs.php
parentcacc939b34e315b85e2d72997811eb6677996cc1 (diff)
Update to MediaWiki 1.21.1
Diffstat (limited to 'maintenance/showJobs.php')
-rw-r--r--maintenance/showJobs.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php
index 1dceb790..8b49517f 100644
--- a/maintenance/showJobs.php
+++ b/maintenance/showJobs.php
@@ -39,21 +39,24 @@ class ShowJobs extends Maintenance {
$this->mDescription = "Show number of jobs waiting in master database";
$this->addOption( 'group', 'Show number of jobs per job type' );
}
+
public function execute() {
- $dbw = wfGetDB( DB_MASTER );
+ $group = JobQueueGroup::singleton();
if ( $this->hasOption( 'group' ) ) {
- $res = $dbw->select(
- 'job',
- array( 'job_cmd', 'count(*) as count' ),
- array(),
- __METHOD__,
- array( 'GROUP BY' => 'job_cmd' )
- );
- foreach ( $res as $row ) {
- $this->output( $row->job_cmd . ': ' . $row->count . "\n" );
+ foreach ( $group->getQueueTypes() as $type ) {
+ $queue = $group->get( $type );
+ $pending = $queue->getSize();
+ $claimed = $queue->getAcquiredCount();
+ if ( ( $pending + $claimed ) > 0 ) {
+ $this->output( "{$type}: $pending queued; $claimed acquired\n" );
+ }
}
} else {
- $this->output( $dbw->selectField( 'job', 'count(*)', '', __METHOD__ ) . "\n" );
+ $count = 0;
+ foreach ( $group->getQueueTypes() as $type ) {
+ $count += $group->get( $type )->getSize();
+ }
+ $this->output( "$count\n" );
}
}
}