X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRecentchangeslinked.php;h=e353f0cbdd49003731a0e5dd1f9279c858232e5a;hb=32199ac8bc293efc5cbd41c3af7fe1055d04d11c;hp=b3b92103804478ca7e940822decc823cd9e457c0;hpb=942446575486057b38e186a8f5599a645758b702;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index b3b9210380..e353f0cbdd 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -47,7 +47,7 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { } /** - * @inheritdoc + * @inheritDoc */ protected function doMainQuery( $tables, $select, $conds, $query_options, $join_conds, FormOptions $opts @@ -103,15 +103,33 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { $join_conds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ]; $select[] = 'page_latest'; } + + $tagFilter = $opts['tagfilter'] ? explode( '|', $opts['tagfilter'] ) : []; ChangeTags::modifyDisplayQuery( $tables, $select, $conds, $join_conds, $query_options, - $opts['tagfilter'] + $tagFilter ); + if ( $dbr->unionSupportsOrderAndLimit() ) { + if ( count( $tagFilter ) > 1 ) { + // ChangeTags::modifyDisplayQuery() will have added DISTINCT. + // To prevent this from causing query performance problems, we need to add + // a GROUP BY, and add rc_id to the ORDER BY. + $order = [ + 'GROUP BY' => 'rc_timestamp, rc_id', + 'ORDER BY' => 'rc_timestamp DESC, rc_id DESC' + ]; + } else { + $order = [ 'ORDER BY' => 'rc_timestamp DESC' ]; + } + } else { + $order = []; + } + if ( !$this->runMainQueryHook( $tables, $select, $conds, $query_options, $join_conds, $opts ) ) { @@ -181,12 +199,6 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { } } - if ( $dbr->unionSupportsOrderAndLimit() ) { - $order = [ 'ORDER BY' => 'rc_timestamp DESC' ]; - } else { - $order = []; - } - $query = $dbr->selectSQLText( array_merge( $tables, [ $link_table ] ), $select,