r106656 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106655‎ | r106656 | r106657 >
Date:14:57, 19 December 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
WikimediaMaintenance: add script for getting the job queue length on all wikis
Modified paths:
  • /trunk/extensions/WikimediaMaintenance/getJobQueueLengths.php (added) (history)

Diff [purge]

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
130 + native

Sign-offs

UserFlagDate
Nikerabbitinspected14:48, 24 December 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r106658Followup r106656: add getJobQueueLengths.php to the list of wikiless scriptscatrope15:41, 19 December 2011

Comments

#Comment by 😂 (talk | contribs)   15:44, 19 December 2011

Every time someone uses $wgConf I kill a whole litter of kittens.

#Comment by Catrope (talk | contribs)   15:45, 19 December 2011

I'm just copypasting code written by The Almighty Tim. Got any better suggestions?

#Comment by 😂 (talk | contribs)   15:46, 19 December 2011

Right now there is no better way. Until I fix it I'll just have to keep my knives sharp.

Status & tagging log