Fix Bug#19637 - self-referencing externals will be by default filtered out
[lhc/web/wiklou.git] / includes / ChangeTags.php
index 7432086..23329c4 100644 (file)
@@ -13,11 +13,15 @@ class ChangeTags {
                $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 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 ) {
@@ -90,7 +94,8 @@ class ChangeTags {
         * 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 ) {
+       static function modifyDisplayQuery( &$tables, &$fields,  &$conds,
+                                                                               &$join_conds, &$options, $filter_tag = false ) {
                global $wgRequest, $wgUseTagFilter;
                
                if ($filter_tag === false) {
@@ -118,6 +123,9 @@ class ChangeTags {
                        // 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.
+                       $options['USE INDEX'] = array( 'change_tag' => 'change_tag_tag_id' );
+                       unset( $options['FORCE INDEX'] );
                        $tables[] = 'change_tag';
                        $join_conds['change_tag'] = array( 'INNER JOIN', "ct_$join_cond=$join_cond" );
                        $conds['ct_tag'] = $filter_tag;
@@ -176,4 +184,4 @@ class ChangeTags {
                $wgMemc->set( $key, $emptyTags, 300 );
                return $emptyTags;
        }
-}
\ No newline at end of file
+}