$tags = explode( ',', $tags );
$displayTags = array();
foreach( $tags as $tag ) {
- $displayTags[] = self::tagDescription( $tag );
- $classes[] = "mw-tag-$tag";
+ $displayTags[] = Xml::tags( 'span',
+ array( 'class' => "mw-tag-marker ".
+ Sanitizer::escapeClass("mw-tag-marker-$tag") ),
+ self::tagDescription( $tag ) );
+ $classes[] = Sanitizer::escapeClass( "mw-tag-$tag" );
}
- return array( '(' . implode( ', ', $displayTags ) . ')', $classes );
+ $markers = '(' . implode( ', ', $displayTags ) . ')';
+ $markers = Xml::tags( 'span', array( 'class' => 'mw-tag-markers' ), $markers );
+ return array( $markers, $classes );
}
static function tagDescription( $tag ) {
* Handles selecting tags, and filtering.
* Needs $tables to be set up properly, so we can figure out which join conditions to use.
*/
- static function modifyDisplayQuery( &$tables, &$fields, &$conds, &$join_conds, $filter_tag = false ) {
- global $wgRequest;
+ static function modifyDisplayQuery( &$tables, &$fields, &$conds,
+ &$join_conds, &$options, $filter_tag = false ) {
+ global $wgRequest, $wgUseTagFilter;
if ($filter_tag === false) {
$filter_tag = $wgRequest->getVal( 'tagfilter' );
$join_conds['tag_summary'] = array( 'LEFT JOIN', "ts_$join_cond=$join_cond" );
$fields[] = 'ts_tags';
- if ($filter_tag) {
+ if ($wgUseTagFilter && $filter_tag) {
// Somebody wants to filter on a tag.
// Add an INNER JOIN on change_tag
+ // FORCE INDEX -- change_tags will almost ALWAYS be the correct query plan.
+ global $wgOldChangeTagsIndex;
+ $index = $wgOldChangeTagsIndex ? 'ct_tag' : 'change_tag_tag_id';
+ $options['USE INDEX'] = array( 'change_tag' => $index );
+ unset( $options['FORCE INDEX'] );
$tables[] = 'change_tag';
$join_conds['change_tag'] = array( 'INNER JOIN', "ct_$join_cond=$join_cond" );
$conds['ct_tag'] = $filter_tag;
* If $fullForm is true, it returns an entire form.
*/
static function buildTagFilterSelector( $selected='', $fullForm = false /* used to put a full form around the selector */ ) {
-
- if ( !count( self::listDefinedTags() ) )
+ global $wgUseTagFilter;
+
+ if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) )
return $fullForm ? '' : array();
global $wgTitle;
$wgMemc->set( $key, $emptyTags, 300 );
return $emptyTags;
}
-}
\ No newline at end of file
+}