- $this->addTables($tables);
- $this->addOption('USE INDEX', $index);
- $this->addFieldsIf('rev_page', $this->fld_ids);
- $this->addFieldsIf('rev_id', $this->fld_ids || $this->fld_flags);
- $this->addFieldsIf('page_latest', $this->fld_flags);
- // $this->addFieldsIf('rev_text_id', $this->fld_ids); // Should this field be exposed?
- $this->addFieldsIf('rev_comment', $this->fld_comment);
- $this->addFieldsIf('rev_minor_edit', $this->fld_flags);
- $this->addFieldsIf('rev_parent_id', $this->fld_flags);
- $this->addFieldsIf('rc_patrolled', $this->fld_patrolled);
+ $this->addTables( $tables );
+ $this->addFieldsIf( 'rev_page', $this->fld_ids );
+ $this->addFieldsIf( 'rev_id', $this->fld_ids || $this->fld_flags );
+ $this->addFieldsIf( 'page_latest', $this->fld_flags );
+ // $this->addFieldsIf( 'rev_text_id', $this->fld_ids ); // Should this field be exposed?
+ $this->addFieldsIf( 'rev_comment', $this->fld_comment || $this->fld_parsedcomment );
+ $this->addFieldsIf( 'rev_len', $this->fld_size );
+ $this->addFieldsIf( 'rev_minor_edit', $this->fld_flags );
+ $this->addFieldsIf( 'rev_parent_id', $this->fld_flags );
+ $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
+
+ if ( $this->fld_tags ) {
+ $this->addTables( 'tag_summary' );
+ $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) );
+ $this->addFields( 'ts_tags' );
+ }
+
+ if ( isset( $this->params['tag'] ) ) {
+ $this->addTables( 'change_tag' );
+ $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
+ $this->addWhereFld( 'ct_tag', $this->params['tag'] );
+ global $wgOldChangeTagsIndex;
+ $index['change_tag'] = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id';
+ }
+
+ $this->addOption( 'USE INDEX', $index );