Go to the documentation of this file.
31 parent::__construct( $query, $moduleName,
'tg' );
37 $prop = array_flip( $params[
'prop'] );
39 $fld_displayname = isset( $prop[
'displayname'] );
40 $fld_description = isset( $prop[
'description'] );
41 $fld_hitcount = isset( $prop[
'hitcount'] );
42 $fld_defined = isset( $prop[
'defined'] );
43 $fld_source = isset( $prop[
'source'] );
44 $fld_active = isset( $prop[
'active'] );
46 $limit = $params[
'limit'];
54 $tagHitcounts = array_merge( $softwareDefinedTags, $explicitlyDefinedTags, $tagStats );
55 $tags = array_keys( $tagHitcounts );
57 # Fetch defined tags that aren't past the continuation
58 if ( $params[
'continue'] !==
null ) {
59 $cont = $params[
'continue'];
60 $tags = array_filter( $tags,
function ( $v ) use ( $cont ) {
65 # Now make sure the array is sorted for proper continuation
69 foreach ( $tags as $tagName ) {
70 if ( ++$count > $limit ) {
76 $tag[
'name'] = $tagName;
78 if ( $fld_displayname ) {
82 if ( $fld_description ) {
83 $msg = $this->
msg(
"tag-$tagName-description" );
84 $tag[
'description'] = $msg->exists() ? $msg->text() :
'';
87 if ( $fld_hitcount ) {
88 $tag[
'hitcount'] = (int)$tagHitcounts[$tagName];
91 $isSoftware = isset( $softwareDefinedTags[$tagName] );
92 $isExplicit = isset( $explicitlyDefinedTags[$tagName] );
95 $tag[
'defined'] = $isSoftware || $isExplicit;
102 $tag[
'source'][] =
'extension';
105 $tag[
'source'][] =
'manual';
110 $tag[
'active'] = $isExplicit || isset( $softwareActivatedTags[$tagName] );
113 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $tag );
120 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'tag' );
157 'action=query&list=tags&tgprop=displayname|description|hitcount|defined'
158 =>
'apihelp-query+tags-example-simple',
163 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Tags';
This is the main query class.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
This is a base class for all Query modules.
const LIMIT_BIG1
Fast query, standard limit.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
const LIMIT_BIG2
Fast query, apihighlimits limit.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...