MediaWiki
REL1_19
|
00001 <?php 00027 require_once( dirname( __FILE__ ) . '/Maintenance.php' ); 00028 00029 class ShowJobs extends Maintenance { 00030 public function __construct() { 00031 parent::__construct(); 00032 $this->mDescription = "Show number of jobs waiting in master database"; 00033 $this->addOption( 'group', 'Show number of jobs per job type' ); 00034 } 00035 public function execute() { 00036 $dbw = wfGetDB( DB_MASTER ); 00037 if ( $this->hasOption( 'group' ) ) { 00038 $res = $dbw->select( 00039 'job', 00040 array( 'job_cmd', 'count(*) as count' ), 00041 array(), 00042 __METHOD__, 00043 array( 'GROUP BY' => 'job_cmd' ) 00044 ); 00045 foreach ( $res as $row ) { 00046 $this->output( $row->job_cmd . ': ' . $row->count . "\n" ); 00047 } 00048 } else { 00049 $this->output( $dbw->selectField( 'job', 'count(*)', '', __METHOD__ ) . "\n" ); 00050 } 00051 } 00052 } 00053 00054 $maintClass = "ShowJobs"; 00055 require_once( RUN_MAINTENANCE_IF_MAIN );