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 ); 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" ); } } else { $this->output( $dbw->selectField( 'job', 'count(*)', '', __METHOD__ ) . "\n" ); } } } $maintClass = "ShowJobs"; require_once( RUN_MAINTENANCE_IF_MAIN );