From: Aaron Schulz Date: Wed, 8 Oct 2014 20:39:09 +0000 (-0700) Subject: Added a --type filter to showJobs.php X-Git-Tag: 1.31.0-rc.0~13653^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=7b6ea3073e8f9e0feb3de0dddf2d828cdef00af4;p=lhc%2Fweb%2Fwiklou.git Added a --type filter to showJobs.php Change-Id: I43d2c9fb949d88364dd000e9892a60ac19412e31 --- diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php index b8dc554841..a9f7d8b419 100644 --- a/maintenance/showJobs.php +++ b/maintenance/showJobs.php @@ -38,16 +38,19 @@ class ShowJobs extends Maintenance { parent::__construct(); $this->mDescription = "Show number of jobs waiting in master database"; $this->addOption( 'group', 'Show number of jobs per job type' ); - $this->addOption( - 'list', - 'Show a complete list of all jobs in a machine-readable format, instead of statistics' - ); + $this->addOption( 'list', + 'Show a list of all jobs in a machine-readable format, instead of statistics' ); + $this->addOption( 'type', 'Only show/count jobs of a given type', false, true ); } public function execute() { + $filterType = $this->getOption( 'type', '' ); $group = JobQueueGroup::singleton(); if ( $this->hasOption( 'list' ) ) { foreach ( $group->getQueueTypes() as $type ) { + if ( $filterType != '' && $type != $filterType ) { + continue; + } $queue = $group->get( $type ); foreach ( $queue->getAllQueuedJobs() as $job ) { $this->output( $job->toString() . " status=unclaimed\n" ); @@ -58,6 +61,9 @@ class ShowJobs extends Maintenance { } } elseif ( $this->hasOption( 'group' ) ) { foreach ( $group->getQueueTypes() as $type ) { + if ( $filterType != '' && $type != $filterType ) { + continue; + } $queue = $group->get( $type ); $delayed = $queue->getDelayedCount(); $pending = $queue->getSize(); @@ -75,6 +81,9 @@ class ShowJobs extends Maintenance { } else { $count = 0; foreach ( $group->getQueueTypes() as $type ) { + if ( $filterType != '' && $type != $filterType ) { + continue; + } $count += $group->get( $type )->getSize(); } $this->output( "$count\n" );