MediaWiki
REL1_21
|
00001 <?php 00028 require_once( __DIR__ . '/Maintenance.php' ); 00029 00036 class ShowJobs extends Maintenance { 00037 public function __construct() { 00038 parent::__construct(); 00039 $this->mDescription = "Show number of jobs waiting in master database"; 00040 $this->addOption( 'group', 'Show number of jobs per job type' ); 00041 } 00042 00043 public function execute() { 00044 $group = JobQueueGroup::singleton(); 00045 if ( $this->hasOption( 'group' ) ) { 00046 foreach ( $group->getQueueTypes() as $type ) { 00047 $queue = $group->get( $type ); 00048 $pending = $queue->getSize(); 00049 $claimed = $queue->getAcquiredCount(); 00050 if ( ( $pending + $claimed ) > 0 ) { 00051 $this->output( "{$type}: $pending queued; $claimed acquired\n" ); 00052 } 00053 } 00054 } else { 00055 $count = 0; 00056 foreach ( $group->getQueueTypes() as $type ) { 00057 $count += $group->get( $type )->getSize(); 00058 } 00059 $this->output( "$count\n" ); 00060 } 00061 } 00062 } 00063 00064 $maintClass = "ShowJobs"; 00065 require_once( RUN_MAINTENANCE_IF_MAIN );