ApiQueryMessageGroupStats.php

Go to the documentation of this file.
00001 <?php
00017 class ApiQueryMessageGroupStats extends ApiStatsQuery {
00018     public function __construct( $query, $moduleName ) {
00019         parent::__construct( $query, $moduleName, 'mgs' );
00020     }
00021 
00022     protected function getData() {
00023         $params = $this->extractRequestParams();
00024         $group = MessageGroups::getGroup( $params['group'] );
00025         if ( !$group ) {
00026             $this->dieUsageMsg( array( 'missingparam', 'mcgroup' ) );
00027         } elseif ( MessageGroups::isDynamic( $group ) ) {
00028             $this->dieUsage( 'Dynamic message groups are not supported here', 'invalidparam' );
00029         }
00030 
00031         return MessageGroupStats::forGroup( $group->getId() );
00032     }
00033 
00034     protected function makeItem( $item, $stats ) {
00035         $data = parent::makeItem( $item, $stats );
00036         $data['code'] = $item; // For BC
00037         $data['language'] = $item;
00038 
00039         return $data;
00040     }
00041 
00042     public function getAllowedParams() {
00043         $params = parent::getAllowedParams();
00044         $params['group'] = array(
00045             ApiBase::PARAM_TYPE => 'string',
00046             ApiBase::PARAM_REQUIRED => true,
00047         );
00048 
00049         return $params;
00050     }
00051 
00052     public function getParamDescription() {
00053         $desc = parent::getParamDescription();
00054         $desc['group'] = 'Message group id';
00055 
00056         return $desc;
00057     }
00058 
00059     public function getDescription() {
00060         return 'Query message group stats';
00061     }
00062 
00063     protected function getExamples() {
00064         $group = 'page-Example';
00065 
00066         return array(
00067             "api.php?action=query&meta=messagegroupstats&mgsgroup=$group List of " .
00068                 "translation completion statistics for group $group",
00069         );
00070     }
00071 }
Generated on Tue Oct 29 00:00:23 2013 for MediaWiki Translate Extension by  doxygen 1.6.3