X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FshowJobs.php;h=8b49517ff835812c9e745bd57235d203ed512acf;hb=9bdc558bc481218235b0b4f1b9c34ff6c86fd56c;hp=ff7d3fc0f555ae6e23b46848f75fb737cabf8d9d;hpb=392af46809d831514f49618cdef1e1529d7fddf4;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php index ff7d3fc0f5..8b49517ff8 100644 --- a/maintenance/showJobs.php +++ b/maintenance/showJobs.php @@ -1,9 +1,9 @@ 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" ); } } }