* format number output of cscore parser function.
* add $wgContribScoresUseRealName to allow display of real user names per request[1]. Requires MediaWiki 1.19 alpha r108126. * remove trailing whitespace. [1] https://www.mediawiki.org/wiki/Thread:Extension_talk:Contribution_Scores/Show_real_name_or_e-mail_instead_of_username%3F
This commit is contained in:
parent
f1e3ad6c82
commit
7467195055
2 changed files with 50 additions and 31 deletions
|
@ -15,7 +15,7 @@ $wgExtensionCredits['specialpage'][] = array(
|
|||
'url' => 'https://www.mediawiki.org/wiki/Extension:Contribution_Scores',
|
||||
'author' => 'Tim Laqua',
|
||||
'descriptionmsg' => 'contributionscores-desc',
|
||||
'version' => '1.13'
|
||||
'version' => '1.14'
|
||||
);
|
||||
|
||||
$dir = dirname( __FILE__ ) . '/';
|
||||
|
@ -24,6 +24,7 @@ define( 'CONTRIBUTIONSCORES_MAXINCLUDELIMIT', 50 );
|
|||
$wgContribScoreReports = null;
|
||||
$wgContribScoreIgnoreBlockedUsers = false;
|
||||
$wgContribScoreIgnoreBots = false;
|
||||
$wgContribScoresUseRealName = false;
|
||||
$wgContribScoreDisableCache = false;
|
||||
|
||||
$wgAutoloadClasses['ContributionScores'] = $dir . 'ContributionScores_body.php';
|
||||
|
@ -58,25 +59,27 @@ function efContributionScores_Render(&$parser, $usertext, $metric='score') {
|
|||
$dbr = wfGetDB( DB_SLAVE );
|
||||
|
||||
if ( $user instanceof User && $user->isLoggedIn() ) {
|
||||
global $wgLang;
|
||||
|
||||
if ($metric=='score') {
|
||||
$res = $dbr->select('revision',
|
||||
'COUNT(DISTINCT rev_page)+SQRT(COUNT(rev_id)-COUNT(DISTINCT rev_page))*2 AS wiki_rank',
|
||||
array('rev_user' => $user->getID()));
|
||||
$row = $dbr->fetchObject($res);
|
||||
$output = round($row->wiki_rank,0);
|
||||
$output = $wgLang->formatNum( round($row->wiki_rank,0) );
|
||||
} elseif ($metric=='changes') {
|
||||
$res = $dbr->select('revision',
|
||||
'COUNT(rev_id) AS rev_count',
|
||||
array('rev_user' => $user->getID()));
|
||||
$row = $dbr->fetchObject($res);
|
||||
$output = $row->rev_count;
|
||||
$output = $wgLang->formatNum( $row->rev_count );
|
||||
|
||||
} elseif ($metric=='pages') {
|
||||
$res = $dbr->select('revision',
|
||||
'COUNT(DISTINCT rev_page) AS page_count',
|
||||
array('rev_user' => $user->getID()));
|
||||
$row = $dbr->fetchObject($res);
|
||||
$output = $row->page_count;
|
||||
$output = $wgLang->formatNum( $row->page_count );
|
||||
} else {
|
||||
$output = wfMsg('contributionscores-invalidmetric');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue