/** @dataProvider provideModifyDisplayQuery */
public function testModifyDisplayQuery( $origQuery, $filter_tag, $useTags, $modifiedQuery ) {
$this->setMwGlobals( 'wgUseTagFilter', $useTags );
+ $rcId = 123;
+ ChangeTags::updateTags( [ 'foo', 'bar' ], [], $rcId );
// HACK resolve deferred group concats (see comment in provideModifyDisplayQuery)
if ( isset( $modifiedQuery['fields']['ts_tags'] ) ) {
$modifiedQuery['fields']['ts_tags'] = call_user_func_array(
public function provideModifyDisplayQuery() {
// HACK if we call $dbr->buildGroupConcatField() now, it will return the wrong table names
// We have to have the test runner call it instead
+ $baseConcats = [ ',', [ 'change_tag', 'change_tag_def' ], 'ctd_name' ];
+ $joinConds = [ 'change_tag_def' => [ 'INNER JOIN', 'ct_tag_id=ctd_id' ] ];
$groupConcats = [
- 'recentchanges' => [ ',', 'change_tag', 'ct_tag', 'ct_rc_id=rc_id' ],
- 'logging' => [ ',', 'change_tag', 'ct_tag', 'ct_log_id=log_id' ],
- 'revision' => [ ',', 'change_tag', 'ct_tag', 'ct_rev_id=rev_id' ],
- 'archive' => [ ',', 'change_tag', 'ct_tag', 'ct_rev_id=ar_rev_id' ],
+ 'recentchanges' => array_merge( $baseConcats, [ 'ct_rc_id=rc_id', $joinConds ] ),
+ 'logging' => array_merge( $baseConcats, [ 'ct_log_id=log_id', $joinConds ] ),
+ 'revision' => array_merge( $baseConcats, [ 'ct_rev_id=rev_id', $joinConds ] ),
+ 'archive' => array_merge( $baseConcats, [ 'ct_rev_id=ar_rev_id', $joinConds ] ),
];
return [
[
'tables' => [ 'recentchanges', 'change_tag' ],
'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ],
- 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag' => 'foo' ],
+ 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ],
'options' => [ 'ORDER BY' => 'rc_timestamp DESC' ],
]
[
'tables' => [ 'logging', 'change_tag' ],
'fields' => [ 'log_id', 'ts_tags' => $groupConcats['logging'] ],
- 'conds' => [ "log_timestamp > '20170714183203'", 'ct_tag' => 'foo' ],
+ 'conds' => [ "log_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_log_id=log_id' ] ],
'options' => [ 'ORDER BY log_timestamp DESC' ],
]
[
'tables' => [ 'revision', 'change_tag' ],
'fields' => [ 'rev_id', 'rev_timestamp', 'ts_tags' => $groupConcats['revision'] ],
- 'conds' => [ "rev_timestamp > '20170714183203'", 'ct_tag' => 'foo' ],
+ 'conds' => [ "rev_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rev_id=rev_id' ] ],
'options' => [ 'ORDER BY' => 'rev_timestamp DESC' ],
]
[
'tables' => [ 'archive', 'change_tag' ],
'fields' => [ 'ar_id', 'ar_timestamp', 'ts_tags' => $groupConcats['archive'] ],
- 'conds' => [ "ar_timestamp > '20170714183203'", 'ct_tag' => 'foo' ],
+ 'conds' => [ "ar_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rev_id=ar_rev_id' ] ],
'options' => [ 'ORDER BY' => 'ar_timestamp DESC' ],
]
[
'tables' => [ 'recentchanges', 'change_tag' ],
'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ],
- 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag' => [ 'foo', 'bar' ] ],
+ 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1, 2 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ],
'options' => [ 'ORDER BY' => 'rc_timestamp DESC', 'DISTINCT' ],
]
[
'tables' => [ 'recentchanges', 'change_tag' ],
'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ],
- 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag' => [ 'foo', 'bar' ] ],
+ 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1, 2 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ],
'options' => [ 'DISTINCT', 'ORDER BY' => 'rc_timestamp DESC' ],
]
[
'tables' => [ 'recentchanges', 'change_tag' ],
'fields' => [ 'rc_id', 'ts_tags' => $groupConcats['recentchanges'] ],
- 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag' => [ 'foo', 'bar' ] ],
+ 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1, 2 ] ],
'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ],
'options' => [ 'ORDER BY rc_timestamp DESC', 'DISTINCT' ],
]