MediaWiki  1.23.2
showJobs.php
Go to the documentation of this file.
1 <?php
28 require_once __DIR__ . '/Maintenance.php';
29 
36 class ShowJobs extends Maintenance {
37  public function __construct() {
38  parent::__construct();
39  $this->mDescription = "Show number of jobs waiting in master database";
40  $this->addOption( 'group', 'Show number of jobs per job type' );
41  $this->addOption( 'list', 'Show a complete list of all jobs in a machine-readable format, instead of statistics' );
42  }
43 
44  public function execute() {
45  $group = JobQueueGroup::singleton();
46  if ( $this->hasOption( 'list' ) ) {
47  foreach ( $group->getQueueTypes() as $type ) {
48  $queue = $group->get( $type );
49  foreach ( $queue->getAllQueuedJobs() as $job ) {
50  $this->output( $job->toString() . " status=unclaimed\n" );
51  }
52  foreach ( $queue->getAllDelayedJobs() as $job ) {
53  $this->output( $job->toString() . " status=delayed\n" );
54  }
55  }
56  } elseif ( $this->hasOption( 'group' ) ) {
57  foreach ( $group->getQueueTypes() as $type ) {
58  $queue = $group->get( $type );
59  $delayed = $queue->getDelayedCount();
60  $pending = $queue->getSize();
61  $claimed = $queue->getAcquiredCount();
62  $abandoned = $queue->getAbandonedCount();
63  $active = max( 0, $claimed - $abandoned );
64  if ( ( $pending + $claimed + $delayed ) > 0 ) {
65  $this->output(
66  "{$type}: $pending queued; " .
67  "$claimed claimed ($active active, $abandoned abandoned); " .
68  "$delayed delayed\n"
69  );
70  }
71  }
72  } else {
73  $count = 0;
74  foreach ( $group->getQueueTypes() as $type ) {
75  $count += $group->get( $type )->getSize();
76  }
77  $this->output( "$count\n" );
78  }
79  }
80 }
81 
82 $maintClass = "ShowJobs";
83 require_once RUN_MAINTENANCE_IF_MAIN;
ShowJobs\__construct
__construct()
Default constructor.
Definition: showJobs.php:37
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Maintenance\addOption
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
Definition: Maintenance.php:169
RUN_MAINTENANCE_IF_MAIN
require_once RUN_MAINTENANCE_IF_MAIN
Definition: maintenance.txt:50
$maintClass
$maintClass
Definition: showJobs.php:82
Maintenance
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
ShowJobs\execute
execute()
Do the actual work.
Definition: showJobs.php:44
$count
$count
Definition: UtfNormalTest2.php:96
$job
if(count( $args)< 1) $job
Definition: recompressTracked.php:42
JobQueueGroup\singleton
static singleton( $wiki=false)
Definition: JobQueueGroup.php:61
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Maintenance\output
output( $out, $channel=null)
Throw some output to the user.
Definition: Maintenance.php:314
Maintenance\hasOption
hasOption( $name)
Checks to see if a particular param exists.
Definition: Maintenance.php:181
ShowJobs
Maintenance script that reports the number of jobs currently waiting in master database.
Definition: showJobs.php:36
$type
$type
Definition: testCompression.php:46