35 parent::__construct(
$query, $moduleName,
'tg' );
41 $prop = array_flip(
$params[
'prop'] );
43 $fld_displayname = isset( $prop[
'displayname'] );
44 $fld_description = isset( $prop[
'description'] );
45 $fld_hitcount = isset( $prop[
'hitcount'] );
46 $fld_defined = isset( $prop[
'defined'] );
47 $fld_source = isset( $prop[
'source'] );
48 $fld_active = isset( $prop[
'active'] );
58 $tagHitcounts = array_merge( $softwareDefinedTags, $explicitlyDefinedTags, $tagStats );
59 $tags = array_keys( $tagHitcounts );
61 # Fetch defined tags that aren't past the continuation
62 if (
$params[
'continue'] !==
null ) {
64 $tags = array_filter( $tags,
function ( $v ) use ( $cont ) {
69 # Now make sure the array is sorted for proper continuation
73 foreach ( $tags as $tagName ) {
74 if ( ++$count > $limit ) {
80 $tag[
'name'] = $tagName;
82 if ( $fld_displayname ) {
86 if ( $fld_description ) {
87 $msg = $this->
msg(
"tag-$tagName-description" );
88 $tag[
'description'] = $msg->exists() ? $msg->text() :
'';
91 if ( $fld_hitcount ) {
92 $tag[
'hitcount'] = intval( $tagHitcounts[$tagName] );
95 $isSoftware = isset( $softwareDefinedTags[$tagName] );
96 $isExplicit = isset( $explicitlyDefinedTags[$tagName] );
99 $tag[
'defined'] = $isSoftware || $isExplicit;
106 $tag[
'source'][] =
'extension';
109 $tag[
'source'][] =
'manual';
114 $tag[
'active'] = $isExplicit || isset( $softwareActivatedTags[$tagName] );
117 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $tag );
124 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'tag' );
162 'action=query&list=tags&tgprop=displayname|description|hitcount|defined'
163 =>
'apihelp-query+tags-example-simple',
168 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Tags';
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
const LIMIT_BIG1
Fast query, standard limit.
getResult()
Get the result object.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
const LIMIT_BIG2
Fast query, apihighlimits limit.
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.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
This is the main query class.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query