35 $prop = array_fill_keys( $params[
'prop'],
true );
37 $fld_displayname = isset( $prop[
'displayname'] );
38 $fld_description = isset( $prop[
'description'] );
39 $fld_hitcount = isset( $prop[
'hitcount'] );
40 $fld_defined = isset( $prop[
'defined'] );
41 $fld_source = isset( $prop[
'source'] );
42 $fld_active = isset( $prop[
'active'] );
44 $limit = $params[
'limit'];
47 $softwareDefinedTags = array_fill_keys( $this->changeTagsStore->listSoftwareDefinedTags(), 0 );
48 $explicitlyDefinedTags = array_fill_keys( $this->changeTagsStore->listExplicitlyDefinedTags(), 0 );
49 $softwareActivatedTags = array_fill_keys( $this->changeTagsStore->listSoftwareActivatedTags(), 0 );
51 $tagHitcounts = array_merge(
53 $explicitlyDefinedTags,
54 $this->changeTagsStore->tagUsageStatistics()
56 $tags = array_keys( $tagHitcounts );
57 $tags = $this->changeTagsStore->filterViewableTags( $tags, $this->
getAuthority() );
59 # Fetch defined tags that aren't past the continuation
60 if ( $params[
'continue'] !==
null ) {
61 $cont = $params[
'continue'];
62 $tags = array_filter( $tags,
static function ( $v ) use ( $cont ) {
67 # Now make sure the array is sorted for proper continuation
71 foreach ( $tags as $tagName ) {
72 if ( ++$count > $limit ) {
78 $tag[
'name'] = $tagName;
80 if ( $fld_displayname ) {
81 $tag[
'displayname'] = $this->changeTagsFormatter->getTagDescription( $tagName, $this );
84 if ( $fld_description ) {
85 $msg = $this->
msg(
"tag-$tagName-description" );
86 $tag[
'description'] = $msg->exists() ? $msg->text() :
'';
89 if ( $fld_hitcount ) {
90 $tag[
'hitcount'] = (int)$tagHitcounts[$tagName];
93 $isSoftware = isset( $softwareDefinedTags[$tagName] );
94 $isExplicit = isset( $explicitlyDefinedTags[$tagName] );
97 $tag[
'defined'] = $isSoftware || $isExplicit;
103 $tag[
'source'][] =
'software';
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' );
141 ParamValidator::PARAM_DEFAULT => 10,
142 ParamValidator::PARAM_TYPE =>
'limit',
143 IntegerDef::PARAM_MIN => 1,
148 ParamValidator::PARAM_DEFAULT =>
'',
149 ParamValidator::PARAM_TYPE => [
157 ParamValidator::PARAM_ISMULTI =>
true,