Merge "Adds configuration directive to filter specified usernames from the contribution scores tables."

This commit is contained in:
jenkins-bot 2021-10-05 14:38:02 +00:00 committed by Gerrit Code Review
commit fb464fbd13
2 changed files with 12 additions and 2 deletions

View file

@ -39,6 +39,10 @@
"value": false,
"description": "Set to true to exclude bots users from the reporting."
},
"ContribScoreIgnoreUsernames": {
"value": [],
"description": "Array of usernames to exclude from the reporting."
},
"ContribScoresUseRealName": {
"value": false,
"description": "Set to true to use real user names when available."

View file

@ -92,8 +92,8 @@ class ContributionScores extends IncludableSpecialPage {
* @return string Html Table representing the requested Contribution Scores.
*/
function genContributionScoreTable( $days, $limit, $title = null, $options = 'none' ) {
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName,
$wgContribScoreUseRoughEditCount;
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoreIgnoreUsernames,
$wgContribScoresUseRealName, $wgContribScoreUseRoughEditCount;
$opts = explode( ',', strtolower( $options ) );
@ -103,6 +103,7 @@ class ContributionScores extends IncludableSpecialPage {
$revQuery['tables'] = array_merge( [ 'revision' ], $revQuery['tables'] );
$revUser = $revQuery['fields']['rev_user'];
$revUsername = $revQuery['fields']['rev_user_text'];
$sqlWhere = [];
@ -136,6 +137,11 @@ class ContributionScores extends IncludableSpecialPage {
], __METHOD__ );
}
if ( count( $wgContribScoreIgnoreUsernames ) ) {
$listIgnoredUsernames = $dbr->makeList( $wgContribScoreIgnoreUsernames );
$sqlWhere[] = "{$revUsername} NOT IN ($listIgnoredUsernames)";
}
if ( $dbr->unionSupportsOrderAndLimit() ) {
$order = [
'GROUP BY' => 'rev_user',