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,
|
||||
"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."
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Reference in a new issue