Adds configuration directive to filter specified usernames from the contribution scores tables.
Bug: T292266 Change-Id: I641fbd3d8b088132cba4f142ee99a8837a02afb3
This commit is contained in:
parent
b7bf249857
commit
35ea80cb36
2 changed files with 12 additions and 2 deletions
|
@ -39,6 +39,10 @@
|
||||||
"value": false,
|
"value": false,
|
||||||
"description": "Set to true to exclude bots users from the reporting."
|
"description": "Set to true to exclude bots users from the reporting."
|
||||||
},
|
},
|
||||||
|
"ContribScoreIgnoreUsernames": {
|
||||||
|
"value": [],
|
||||||
|
"description": "Array of usernames to exclude from the reporting."
|
||||||
|
},
|
||||||
"ContribScoresUseRealName": {
|
"ContribScoresUseRealName": {
|
||||||
"value": false,
|
"value": false,
|
||||||
"description": "Set to true to use real user names when available."
|
"description": "Set to true to use real user names when available."
|
||||||
|
|
|
@ -92,8 +92,8 @@ class ContributionScores extends IncludableSpecialPage {
|
||||||
* @return string Html Table representing the requested Contribution Scores.
|
* @return string Html Table representing the requested Contribution Scores.
|
||||||
*/
|
*/
|
||||||
function genContributionScoreTable( $days, $limit, $title = null, $options = 'none' ) {
|
function genContributionScoreTable( $days, $limit, $title = null, $options = 'none' ) {
|
||||||
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName,
|
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoreIgnoreUsernames,
|
||||||
$wgContribScoreUseRoughEditCount;
|
$wgContribScoresUseRealName, $wgContribScoreUseRoughEditCount;
|
||||||
|
|
||||||
$opts = explode( ',', strtolower( $options ) );
|
$opts = explode( ',', strtolower( $options ) );
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ class ContributionScores extends IncludableSpecialPage {
|
||||||
$revQuery['tables'] = array_merge( [ 'revision' ], $revQuery['tables'] );
|
$revQuery['tables'] = array_merge( [ 'revision' ], $revQuery['tables'] );
|
||||||
|
|
||||||
$revUser = $revQuery['fields']['rev_user'];
|
$revUser = $revQuery['fields']['rev_user'];
|
||||||
|
$revUsername = $revQuery['fields']['rev_user_text'];
|
||||||
|
|
||||||
$sqlWhere = [];
|
$sqlWhere = [];
|
||||||
|
|
||||||
|
@ -136,6 +137,11 @@ class ContributionScores extends IncludableSpecialPage {
|
||||||
], __METHOD__ );
|
], __METHOD__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( count( $wgContribScoreIgnoreUsernames ) ) {
|
||||||
|
$listIgnoredUsernames = $dbr->makeList( $wgContribScoreIgnoreUsernames );
|
||||||
|
$sqlWhere[] = "{$revUsername} NOT IN ($listIgnoredUsernames)";
|
||||||
|
}
|
||||||
|
|
||||||
if ( $dbr->unionSupportsOrderAndLimit() ) {
|
if ( $dbr->unionSupportsOrderAndLimit() ) {
|
||||||
$order = [
|
$order = [
|
||||||
'GROUP BY' => 'rev_user',
|
'GROUP BY' => 'rev_user',
|
||||||
|
|
Loading…
Add table
Reference in a new issue