diff --git a/extension.json b/extension.json index 94212dd..74eeec0 100644 --- a/extension.json +++ b/extension.json @@ -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." diff --git a/src/ContributionScores.php b/src/ContributionScores.php index 1434243..be222a1 100644 --- a/src/ContributionScores.php +++ b/src/ContributionScores.php @@ -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',