Index: trunk/extensions/WikimediaMaintenance/getJobQueueLengths.php |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Get the length of the job queue on all wikis in $wgConf |
| 6 | + */ |
| 7 | + |
| 8 | +require_once( dirname( __FILE__ ) .'/WikimediaMaintenance.php' ); |
| 9 | + |
| 10 | +class GetJobQueueLengths extends WikimediaMaintenance { |
| 11 | + function __construct() { |
| 12 | + parent::__construct(); |
| 13 | + $this->mDescription = 'Get the length of the job queue on all wikis in $wgConf'; |
| 14 | + } |
| 15 | + |
| 16 | + function execute() { |
| 17 | + global $wgConf; |
| 18 | + foreach ( $wgConf->getLocalDatabases() as $wiki ) { |
| 19 | + $lb = wfGetLB( $wiki ); |
| 20 | + $db = $lb->getConnection( DB_MASTER, array(), $wiki ); |
| 21 | + $count = intval( $db->selectField( 'job', 'COUNT(*)', '', __METHOD__ ) ); |
| 22 | + $this->output( "$wiki $count\n" ); |
| 23 | + $lb->reuseConnection( $db ); |
| 24 | + } |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +$maintClass = 'GetJobQueueLengths'; |
| 29 | +require_once( DO_MAINTENANCE ); |
Property changes on: trunk/extensions/WikimediaMaintenance/getJobQueueLengths.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 30 | + native |