33 $prop = array_fill_keys( $params[
'prop'],
true );
35 $fld_displayname = isset( $prop[
'displayname'] );
36 $fld_description = isset( $prop[
'description'] );
37 $fld_hitcount = isset( $prop[
'hitcount'] );
38 $fld_defined = isset( $prop[
'defined'] );
39 $fld_source = isset( $prop[
'source'] );
40 $fld_active = isset( $prop[
'active'] );
42 $limit = $params[
'limit'];
45 $softwareDefinedTags = array_fill_keys( $this->changeTagsStore->listSoftwareDefinedTags(), 0 );
46 $explicitlyDefinedTags = array_fill_keys( $this->changeTagsStore->listExplicitlyDefinedTags(), 0 );
47 $softwareActivatedTags = array_fill_keys( $this->changeTagsStore->listSoftwareActivatedTags(), 0 );
49 $tagHitcounts = array_merge(
51 $explicitlyDefinedTags,
52 $this->changeTagsStore->tagUsageStatistics()
54 $tags = array_keys( $tagHitcounts );
56 # Fetch defined tags that aren't past the continuation
57 if ( $params[
'continue'] !==
null ) {
58 $cont = $params[
'continue'];
59 $tags = array_filter( $tags,
static function ( $v ) use ( $cont ) {
64 # Now make sure the array is sorted for proper continuation
68 foreach ( $tags as $tagName ) {
69 if ( ++$count > $limit ) {
75 $tag[
'name'] = $tagName;
77 if ( $fld_displayname ) {
78 $tag[
'displayname'] = ChangeTags::tagDescription( $tagName, $this );
81 if ( $fld_description ) {
82 $msg = $this->
msg(
"tag-$tagName-description" );
83 $tag[
'description'] = $msg->exists() ? $msg->text() :
'';
86 if ( $fld_hitcount ) {
87 $tag[
'hitcount'] = (int)$tagHitcounts[$tagName];
90 $isSoftware = isset( $softwareDefinedTags[$tagName] );
91 $isExplicit = isset( $explicitlyDefinedTags[$tagName] );
94 $tag[
'defined'] = $isSoftware || $isExplicit;
100 $tag[
'source'][] =
'software';
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' );
135 ParamValidator::PARAM_DEFAULT => 10,
136 ParamValidator::PARAM_TYPE =>
'limit',
137 IntegerDef::PARAM_MIN => 1,
142 ParamValidator::PARAM_DEFAULT =>
'',
143 ParamValidator::PARAM_TYPE => [
151 ParamValidator::PARAM_ISMULTI =>
true,