Add support for actor
Bug: T211037 Change-Id: Ia395f904d12d96e0d8bf0c1b2a5f638639b3ab12
This commit is contained in:
parent
2668446cd7
commit
192f38dc4c
2 changed files with 107 additions and 45 deletions
|
@ -64,22 +64,38 @@ function efContributionScores_Render( &$parser, $usertext, $metric = 'score' ) {
|
|||
if ( $user instanceof User && $user->isLoggedIn() ) {
|
||||
global $wgLang;
|
||||
|
||||
$revWhere = ActorMigration::newMigration()->getWhere( $dbr, 'rev_user', $user );
|
||||
if ( $metric == 'score' ) {
|
||||
$res = $dbr->select( 'revision',
|
||||
$res = $dbr->select(
|
||||
[ 'revision' ] + $revWhere['tables'],
|
||||
'COUNT(DISTINCT rev_page)+SQRT(COUNT(rev_id)-COUNT(DISTINCT rev_page))*2 AS wiki_rank',
|
||||
[ 'rev_user' => $user->getID() ] );
|
||||
$revWhere['conds'],
|
||||
__METHOD__,
|
||||
[],
|
||||
$revWhere['joins']
|
||||
);
|
||||
$row = $dbr->fetchObject( $res );
|
||||
$output = $wgLang->formatNum( round( $row->wiki_rank, 0 ) );
|
||||
} elseif ( $metric == 'changes' ) {
|
||||
$res = $dbr->select( 'revision',
|
||||
$res = $dbr->select(
|
||||
[ 'revision' ] + $revWhere['tables'],
|
||||
'COUNT(rev_id) AS rev_count',
|
||||
[ 'rev_user' => $user->getID() ] );
|
||||
$revWhere['conds'],
|
||||
__METHOD__,
|
||||
[],
|
||||
$revWhere['joins']
|
||||
);
|
||||
$row = $dbr->fetchObject( $res );
|
||||
$output = $wgLang->formatNum( $row->rev_count );
|
||||
} elseif ( $metric == 'pages' ) {
|
||||
$res = $dbr->select( 'revision',
|
||||
$res = $dbr->select(
|
||||
[ 'revision' ] + $revWhere['tables'],
|
||||
'COUNT(DISTINCT rev_page) AS page_count',
|
||||
[ 'rev_user' => $user->getID() ] );
|
||||
$revWhere['conds'],
|
||||
__METHOD__,
|
||||
[],
|
||||
$revWhere['joins']
|
||||
);
|
||||
$row = $dbr->fetchObject( $res );
|
||||
$output = $wgLang->formatNum( $row->page_count );
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue