* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* Query module to enumerate change tags.
*
*/
class ApiQueryTags extends ApiQueryBase {
- private $limit, $result;
+ /**
+ * @var ApiResult
+ */
+ private $result;
+
+ private $limit;
private $fld_displayname = false, $fld_description = false,
$fld_hitcount = false;
$this->addTables( 'change_tag' );
$this->addFields( 'ct_tag' );
- if ( $this->fld_hitcount ) {
- $this->addFields( 'count(*) AS hitcount' );
- }
+ $this->addFieldsIf( 'count(*) AS hitcount', $this->fld_hitcount );
$this->addOption( 'LIMIT', $this->limit + 1 );
$this->addOption( 'GROUP BY', 'ct_tag' );
}
if ( $this->fld_description ) {
- $msg = wfMsg( "tag-$tagName-description" );
- $msg = wfEmptyMsg( "tag-$tagName-description", $msg ) ? '' : $msg;
- $tag['description'] = $msg;
+ $msg = wfMessage( "tag-$tagName-description" );
+ $tag['description'] = $msg->exists() ? $msg->text() : '';
}
if ( $this->fld_hitcount ) {
);
}
+ public function getResultProperties() {
+ return array(
+ '' => array(
+ 'name' => 'string'
+ ),
+ 'displayname' => array(
+ 'displayname' => 'string'
+ ),
+ 'description' => array(
+ 'description' => 'string'
+ ),
+ 'hitcount' => array(
+ 'hitcount' => 'integer'
+ )
+ );
+ }
+
public function getDescription() {
return 'List change tags';
}
- protected function getExamples() {
+ public function getExamples() {
return array(
'api.php?action=query&list=tags&tgprop=displayname|description|hitcount'
);