34 $prop = array_fill_keys( $params[
'prop'],
true );
36 $fld_displayname = isset( $prop[
'displayname'] );
37 $fld_description = isset( $prop[
'description'] );
38 $fld_hitcount = isset( $prop[
'hitcount'] );
39 $fld_defined = isset( $prop[
'defined'] );
40 $fld_source = isset( $prop[
'source'] );
41 $fld_active = isset( $prop[
'active'] );
43 $limit = $params[
'limit'];
46 $softwareDefinedTags = array_fill_keys( $this->changeTagsStore->listSoftwareDefinedTags(), 0 );
47 $explicitlyDefinedTags = array_fill_keys( $this->changeTagsStore->listExplicitlyDefinedTags(), 0 );
48 $softwareActivatedTags = array_fill_keys( $this->changeTagsStore->listSoftwareActivatedTags(), 0 );
50 $tagHitcounts = array_merge(
52 $explicitlyDefinedTags,
53 $this->changeTagsStore->tagUsageStatistics()
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,
static 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 ) {
79 $tag[
'displayname'] = ChangeTags::tagDescription( $tagName, $this );
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;
101 $tag[
'source'][] =
'software';
103 $tag[
'source'][] =
'extension';
106 $tag[
'source'][] =
'manual';
111 $tag[
'active'] = $isExplicit || isset( $softwareActivatedTags[$tagName] );
114 $fit = $result->addValue( [
'query', $this->
getModuleName() ],
null, $tag );
121 $result->addIndexedTagName( [
'query', $this->
getModuleName() ],
'tag' );
136 ParamValidator::PARAM_DEFAULT => 10,
137 ParamValidator::PARAM_TYPE =>
'limit',
138 IntegerDef::PARAM_MIN => 1,
143 ParamValidator::PARAM_DEFAULT =>
'',
144 ParamValidator::PARAM_TYPE => [
152 ParamValidator::PARAM_ISMULTI =>
true,