$fld_description = isset( $prop['description'] );
$fld_hitcount = isset( $prop['hitcount'] );
$fld_defined = isset( $prop['defined'] );
+ $fld_source = isset( $prop['source'] );
+ $fld_active = isset( $prop['active'] );
$limit = $params['limit'];
$result = $this->getResult();
- $definedTags = array_fill_keys( ChangeTags::listDefinedTags(), 0 );
+ $extensionDefinedTags = array_fill_keys( ChangeTags::listExtensionDefinedTags(), 0 );
+ $explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
+ $extensionActivatedTags = array_fill_keys( ChangeTags::listExtensionActivatedTags(), 0 );
+
+ $definedTags = array_merge( $extensionDefinedTags, $explicitlyDefinedTags );
# Fetch defined tags that aren't past the continuation
if ( $params['continue'] !== null ) {
$tag['hitcount'] = $hitcount;
}
- if ( $fld_defined && isset( $definedTags[$tagName] ) ) {
- $tag['defined'] = '';
+ $isExtension = isset( $extensionDefinedTags[$tagName] );
+ $isExplicit = isset( $explicitlyDefinedTags[$tagName] );
+
+ if ( $fld_defined ) {
+ $tag['defined'] = $isExtension || $isExplicit;
+ }
+
+ if ( $fld_source ) {
+ $tag['source'] = array();
+ if ( $isExtension ) {
+ $tag['source'][] = 'extension';
+ }
+ if ( $isExplicit ) {
+ $tag['source'][] = 'manual';
+ }
+ }
+
+ if ( $fld_active ) {
+ $tag['active'] = $isExplicit || isset( $extensionActivatedTags[$tagName] );
}
$fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $tag );
}
}
- $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'tag' );
+ $result->addIndexedTagName( array( 'query', $this->getModuleName() ), 'tag' );
}
public function getCacheMode( $params ) {
'description',
'hitcount',
'defined',
+ 'source',
+ 'active',
),
ApiBase::PARAM_ISMULTI => true
)