summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/api/ApiQueryMessageGroupStats.php')
-rw-r--r--MLEB/Translate/api/ApiQueryMessageGroupStats.php59
1 files changed, 16 insertions, 43 deletions
diff --git a/MLEB/Translate/api/ApiQueryMessageGroupStats.php b/MLEB/Translate/api/ApiQueryMessageGroupStats.php
index a1059fcb..3f9ea6c4 100644
--- a/MLEB/Translate/api/ApiQueryMessageGroupStats.php
+++ b/MLEB/Translate/api/ApiQueryMessageGroupStats.php
@@ -4,9 +4,9 @@
*
* @file
* @author Tim Gerundt
+ * @author Niklas Laxström
* @copyright Copyright © 2012-2013, Tim Gerundt
- * @copyright Copyright © 2012-2013, Niklas Laxström
- * @license GPL-2.0+
+ * @license GPL-2.0-or-later
*/
/**
@@ -19,16 +19,21 @@ class ApiQueryMessageGroupStats extends ApiStatsQuery {
parent::__construct( $query, $moduleName, 'mgs' );
}
- protected function getData() {
- $params = $this->extractRequestParams();
+ /// Overwritten from ApiStatsQuery
+ protected function validateTargetParamater( array $params ) {
$group = MessageGroups::getGroup( $params['group'] );
if ( !$group ) {
- $this->dieUsageMsg( array( 'missingparam', 'mcgroup' ) );
+ $this->dieWithError( [ 'apierror-missingparam', 'mgsgroup' ] );
} elseif ( MessageGroups::isDynamic( $group ) ) {
- $this->dieUsage( 'Dynamic message groups are not supported here', 'invalidparam' );
+ $this->dieWithError( 'apierror-translate-nodynamicgroups', 'invalidparam' );
}
- return MessageGroupStats::forGroup( $group->getId() );
+ return $group->getId();
+ }
+
+ /// Overwritten from ApiStatsQuery
+ protected function loadStatistics( $target, $flags = 0 ) {
+ return MessageGroupStats::forGroup( $target, $flags );
}
protected function makeItem( $item, $stats ) {
@@ -41,50 +46,18 @@ class ApiQueryMessageGroupStats extends ApiStatsQuery {
public function getAllowedParams() {
$params = parent::getAllowedParams();
- $params['group'] = array(
+ $params['group'] = [
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => true,
- );
+ ];
return $params;
}
- /**
- * @deprecated since MediaWiki core 1.25
- */
- public function getParamDescription() {
- $desc = parent::getParamDescription();
- $desc['group'] = 'Message group id';
-
- return $desc;
- }
-
- /**
- * @deprecated since MediaWiki core 1.25
- */
- public function getDescription() {
- return 'Query message group stats';
- }
-
- /**
- * @deprecated since MediaWiki core 1.25
- */
- protected function getExamples() {
- $group = 'page-Example';
-
- return array(
- "api.php?action=query&meta=messagegroupstats&mgsgroup=$group List of " .
- "translation completion statistics for group $group",
- );
- }
-
- /**
- * @see ApiBase::getExamplesMessages()
- */
protected function getExamplesMessages() {
- return array(
+ return [
'action=query&meta=messagegroupstats&mgsgroup=page-Example'
=> 'apihelp-query+messagegroupstats-example-1',
- );
+ ];
}
}