Compare commits
113 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
384fdfa2bf | ||
![]() |
7f40072416 | ||
![]() |
e00a3b1c57 | ||
![]() |
95976e0082 | ||
![]() |
00af3f2598 | ||
![]() |
2b415b36b5 | ||
![]() |
1cf9ae8247 | ||
![]() |
548a1f177c | ||
![]() |
645c945994 | ||
![]() |
4212d24b49 | ||
![]() |
7d145662fa | ||
![]() |
7cc5575eaa | ||
![]() |
945f54a773 | ||
![]() |
d4dae78b27 | ||
![]() |
e307850555 | ||
![]() |
790e23f9bb | ||
![]() |
7fa71f5e78 | ||
![]() |
6666f47f3b | ||
![]() |
46ebf43828 | ||
![]() |
c68abe1641 | ||
![]() |
f9aa4a74b3 | ||
![]() |
d4132dab01 | ||
![]() |
228317e7c6 | ||
![]() |
c1d095e381 | ||
![]() |
120ae2bac0 | ||
![]() |
fb464fbd13 | ||
![]() |
6a8d6116e1 | ||
![]() |
35ea80cb36 | ||
![]() |
b7bf249857 | ||
![]() |
0a533b36f5 | ||
![]() |
5be2c8ed72 | ||
![]() |
71ace6a83c | ||
![]() |
6024bfd83b | ||
![]() |
5ade4bf529 | ||
![]() |
81fe64aea5 | ||
![]() |
32d5ef59fa | ||
![]() |
b0e2a7c59a | ||
![]() |
89e7ebc584 | ||
![]() |
908d2f68a2 | ||
![]() |
95800b51f3 | ||
![]() |
bb3429ecff | ||
![]() |
e5d96719d8 | ||
![]() |
fcb9c19544 | ||
![]() |
20f33b07f3 | ||
![]() |
309914b267 | ||
![]() |
571a707b3b | ||
![]() |
20b9a568e2 | ||
![]() |
4dc3f4fc3e | ||
![]() |
6fac0091ec | ||
![]() |
0c3861304e | ||
![]() |
9f53a1eba9 | ||
![]() |
2dc00fa1ae | ||
![]() |
ca10b2089e | ||
![]() |
fdcc307d8e | ||
![]() |
9d46bcf5c7 | ||
![]() |
b8a91c6731 | ||
![]() |
e51c7662d1 | ||
![]() |
18e42f349b | ||
![]() |
ddd94477cf | ||
![]() |
95f9a48ac4 | ||
![]() |
5aefac796c | ||
![]() |
4f60431795 | ||
![]() |
b11635777b | ||
![]() |
f42092ec06 | ||
![]() |
a131b2a47b | ||
![]() |
6e2d039150 | ||
![]() |
b04514e353 | ||
![]() |
de739003d4 | ||
![]() |
ea143f6b66 | ||
![]() |
70cc5ee193 | ||
![]() |
234c4f6622 | ||
![]() |
2b3ff2324d | ||
![]() |
4817b0112c | ||
![]() |
371c9a0a44 | ||
![]() |
b4321e9f90 | ||
![]() |
2af4934cbd | ||
![]() |
f260a7ad76 | ||
![]() |
73ed304e2c | ||
![]() |
e9f8e17919 | ||
![]() |
3de3b235c6 | ||
![]() |
82ae323231 | ||
![]() |
3ceddd3f31 | ||
![]() |
82788a63ed | ||
![]() |
d5dca87239 | ||
![]() |
192f38dc4c | ||
![]() |
02766fdc0c | ||
![]() |
896045f848 | ||
![]() |
f7f3af5657 | ||
![]() |
e81fb24586 | ||
![]() |
3bb49646fe | ||
![]() |
cba65cdeb6 | ||
![]() |
e70a6bb4d0 | ||
![]() |
2668446cd7 | ||
![]() |
27e579e3c3 | ||
![]() |
e745e56085 | ||
![]() |
a3c92f6e07 | ||
![]() |
81dd4ee4a6 | ||
![]() |
b317d2566e | ||
![]() |
0ca704c7d1 | ||
![]() |
e4a9083d8f | ||
![]() |
3b8629ad9b | ||
![]() |
30eace5dec | ||
![]() |
c73ace56c4 | ||
![]() |
3837153bab | ||
![]() |
9d10a949e5 | ||
![]() |
6cdaa361c1 | ||
![]() |
8d97dcf311 | ||
![]() |
3491a9442a | ||
![]() |
bc2d5f0861 | ||
![]() |
0fefd2e406 | ||
![]() |
a9e0eb0470 | ||
![]() |
49dc2d232e | ||
![]() |
7272a4fe24 |
62 changed files with 6433 additions and 2538 deletions
8
.eslintrc.json
Normal file
8
.eslintrc.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"root": true,
|
||||
"extends": [
|
||||
"wikimedia/client-es5",
|
||||
"wikimedia/jquery",
|
||||
"wikimedia/mediawiki"
|
||||
]
|
||||
}
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
node_modules/
|
||||
/composer.lock
|
||||
/vendor/
|
||||
/.eslintcache
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
node_modules
|
||||
vendor
|
|
@ -1,13 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset>
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
||||
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage" />
|
||||
<exclude name="PSR12.Properties.ConstantVisibility.NotFound" />
|
||||
<exclude name="Squiz.Scope.MethodScope.Missing" />
|
||||
</rule>
|
||||
<file>.</file>
|
||||
<arg name="extensions" value="php,php5,inc" />
|
||||
<arg name="extensions" value="php" />
|
||||
<arg name="encoding" value="UTF-8" />
|
||||
</ruleset>
|
||||
|
|
|
@ -233,6 +233,16 @@ $specialPageAliases['sk'] = [
|
|||
'ContributionScores' => [ 'SkórePríspevkov' ],
|
||||
];
|
||||
|
||||
/** Serbian Cyrillic (српски (ћирилица)) */
|
||||
$specialPageAliases['sr-ec'] = [
|
||||
'ContributionScores' => [ 'ОценеДоприноса' ],
|
||||
];
|
||||
|
||||
/** Serbian Latin (srpski (latinica)) */
|
||||
$specialPageAliases['sr-el'] = [
|
||||
'ContributionScores' => [ 'OceneDoprinosa' ],
|
||||
];
|
||||
|
||||
/** Swedish (svenska) */
|
||||
$specialPageAliases['sv'] = [
|
||||
'ContributionScores' => [ 'Bidragspoäng' ],
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
/** \file
|
||||
* \brief Contains setup code for the Contribution Scores Extension.
|
||||
*/
|
||||
|
||||
# Not a valid entry point, skip unless MEDIAWIKI is defined
|
||||
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||
echo 'Contribution Scores extension';
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
$wgExtensionCredits['specialpage'][] = [
|
||||
'path' => __FILE__,
|
||||
'name' => 'Contribution Scores',
|
||||
'url' => 'https://www.mediawiki.org/wiki/Extension:Contribution_Scores',
|
||||
'author' => 'Tim Laqua',
|
||||
'descriptionmsg' => 'contributionscores-desc',
|
||||
'version' => '1.25.0'
|
||||
];
|
||||
|
||||
define( 'CONTRIBUTIONSCORES_MAXINCLUDELIMIT', 50 );
|
||||
$wgContribScoreReports = null;
|
||||
|
||||
// These settings can be overridden in LocalSettings.php.
|
||||
|
||||
// Set to true to exclude bots from the reporting.
|
||||
$wgContribScoreIgnoreBlockedUsers = false;
|
||||
|
||||
// Set to true to exclude blocked users from the reporting.
|
||||
$wgContribScoreIgnoreBots = false;
|
||||
|
||||
// Set to true to use real user names when available. Only for MediaWiki 1.19 and later.
|
||||
$wgContribScoresUseRealName = false;
|
||||
|
||||
// Set to true to disable cache for parser function and inclusion of table.
|
||||
$wgContribScoreDisableCache = false;
|
||||
|
||||
$wgAutoloadClasses['ContributionScores'] = __DIR__ . '/ContributionScores_body.php';
|
||||
$wgSpecialPages['ContributionScores'] = 'ContributionScores';
|
||||
|
||||
$wgMessagesDirs['ContributionScores'] = __DIR__ . '/i18n';
|
||||
$wgExtensionMessagesFiles['ContributionScoresAlias'] = __DIR__ . '/ContributionScores.alias.php';
|
||||
$wgExtensionMessagesFiles['ContributionScoresMagic'] =
|
||||
__DIR__ . '/ContributionScores.i18n.magic.php';
|
||||
|
||||
$wgHooks['ParserFirstCallInit'][] = 'efContributionScores_Setup';
|
||||
|
||||
function efContributionScores_Setup( &$parser ) {
|
||||
$parser->setFunctionHook( 'cscore', 'efContributionScores_Render' );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function efContributionScores_Render( &$parser, $usertext, $metric = 'score' ) {
|
||||
global $wgContribScoreDisableCache;
|
||||
|
||||
if ( $wgContribScoreDisableCache ) {
|
||||
$parser->disableCache();
|
||||
}
|
||||
|
||||
$user = User::newFromName( $usertext );
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
|
||||
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',
|
||||
[ 'rev_user' => $user->getID() ] );
|
||||
$row = $dbr->fetchObject( $res );
|
||||
$output = $wgLang->formatNum( round( $row->wiki_rank, 0 ) );
|
||||
} elseif ( $metric == 'changes' ) {
|
||||
$res = $dbr->select( 'revision',
|
||||
'COUNT(rev_id) AS rev_count',
|
||||
[ 'rev_user' => $user->getID() ] );
|
||||
$row = $dbr->fetchObject( $res );
|
||||
$output = $wgLang->formatNum( $row->rev_count );
|
||||
} elseif ( $metric == 'pages' ) {
|
||||
$res = $dbr->select( 'revision',
|
||||
'COUNT(DISTINCT rev_page) AS page_count',
|
||||
[ 'rev_user' => $user->getID() ] );
|
||||
$row = $dbr->fetchObject( $res );
|
||||
$output = $wgLang->formatNum( $row->page_count );
|
||||
} else {
|
||||
$output = wfMessage( 'contributionscores-invalidmetric' )->text();
|
||||
}
|
||||
} else {
|
||||
$output = wfMessage( 'contributionscores-invalidusername' )->text();
|
||||
}
|
||||
|
||||
return $parser->insertStripItem( $output, $parser->mStripState );
|
||||
}
|
|
@ -1,275 +0,0 @@
|
|||
<?php
|
||||
/** \file
|
||||
* \brief Contains code for the ContributionScores Class (extends SpecialPage).
|
||||
*/
|
||||
|
||||
/// Special page class for the Contribution Scores extension
|
||||
/**
|
||||
* Special page that generates a list of wiki contributors based
|
||||
* on edit diversity (unique pages edited) and edit volume (total
|
||||
* number of edits.
|
||||
*
|
||||
* @ingroup Extensions
|
||||
* @author Tim Laqua <t.laqua@gmail.com>
|
||||
*/
|
||||
class ContributionScores extends IncludableSpecialPage {
|
||||
public function __construct() {
|
||||
parent::__construct( 'ContributionScores' );
|
||||
}
|
||||
|
||||
/// Generates a "Contribution Scores" table for a given LIMIT and date range
|
||||
|
||||
/**
|
||||
* Function generates Contribution Scores tables in HTML format (not wikiText)
|
||||
*
|
||||
* @param int $days Days in the past to run report for
|
||||
* @param int $limit Maximum number of users to return (default 50)
|
||||
* @param string|null $title The title of the table
|
||||
* @param array $options array of options (default none; nosort/notools)
|
||||
* @return string Html Table representing the requested Contribution Scores.
|
||||
*/
|
||||
function genContributionScoreTable( $days, $limit, $title = null, $options = 'none' ) {
|
||||
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName;
|
||||
|
||||
$opts = explode( ',', strtolower( $options ) );
|
||||
|
||||
$dbr = wfGetDB( DB_REPLICA );
|
||||
|
||||
$userTable = $dbr->tableName( 'user' );
|
||||
$userGroupTable = $dbr->tableName( 'user_groups' );
|
||||
$revTable = $dbr->tableName( 'revision' );
|
||||
$ipBlocksTable = $dbr->tableName( 'ipblocks' );
|
||||
|
||||
$sqlWhere = "";
|
||||
$nextPrefix = "WHERE";
|
||||
|
||||
if ( $days > 0 ) {
|
||||
$date = time() - ( 60 * 60 * 24 * $days );
|
||||
$dateString = $dbr->timestamp( $date );
|
||||
$sqlWhere .= " {$nextPrefix} rev_timestamp > '$dateString'";
|
||||
$nextPrefix = "AND";
|
||||
}
|
||||
|
||||
if ( $wgContribScoreIgnoreBlockedUsers ) {
|
||||
$sqlWhere .= " {$nextPrefix} rev_user NOT IN " .
|
||||
"(SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
|
||||
$nextPrefix = "AND";
|
||||
}
|
||||
|
||||
if ( $wgContribScoreIgnoreBots ) {
|
||||
$sqlWhere .= " {$nextPrefix} rev_user NOT IN " .
|
||||
"(SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
|
||||
}
|
||||
|
||||
$sqlMostPages = "SELECT rev_user,
|
||||
COUNT(DISTINCT rev_page) AS page_count,
|
||||
COUNT(rev_id) AS rev_count
|
||||
FROM {$revTable}
|
||||
{$sqlWhere}
|
||||
GROUP BY rev_user
|
||||
ORDER BY page_count DESC
|
||||
LIMIT {$limit}";
|
||||
|
||||
$sqlMostRevs = "SELECT rev_user,
|
||||
COUNT(DISTINCT rev_page) AS page_count,
|
||||
COUNT(rev_id) AS rev_count
|
||||
FROM {$revTable}
|
||||
{$sqlWhere}
|
||||
GROUP BY rev_user
|
||||
ORDER BY rev_count DESC
|
||||
LIMIT {$limit}";
|
||||
|
||||
$sql = "SELECT user_id, " .
|
||||
"user_name, " .
|
||||
"user_real_name, " .
|
||||
"page_count, " .
|
||||
"rev_count, " .
|
||||
"page_count+SQRT(rev_count-page_count)*2 AS wiki_rank " .
|
||||
"FROM $userTable u JOIN (($sqlMostPages) UNION ($sqlMostRevs)) s ON (user_id=rev_user) " .
|
||||
"ORDER BY wiki_rank DESC " .
|
||||
"LIMIT $limit";
|
||||
|
||||
$res = $dbr->query( $sql );
|
||||
|
||||
$sortable = in_array( 'nosort', $opts ) ? '' : ' sortable';
|
||||
|
||||
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" .
|
||||
"<tr class='header'>\n" .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-rank' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-score' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-pages' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-changes' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-username' )->text() );
|
||||
|
||||
$altrow = '';
|
||||
$user_rank = 1;
|
||||
|
||||
$lang = $this->getLanguage();
|
||||
foreach ( $res as $row ) {
|
||||
// Use real name if option used and real name present.
|
||||
if ( $wgContribScoresUseRealName && $row->user_real_name !== '' ) {
|
||||
$userLink = Linker::userLink(
|
||||
$row->user_id,
|
||||
$row->user_name,
|
||||
$row->user_real_name
|
||||
);
|
||||
} else {
|
||||
$userLink = Linker::userLink(
|
||||
$row->user_id,
|
||||
$row->user_name
|
||||
);
|
||||
}
|
||||
|
||||
$output .= Html::closeElement( 'tr' );
|
||||
$output .= "<tr class='{$altrow}'>\n" .
|
||||
"<td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( round( $user_rank, 0 ) ) .
|
||||
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( round( $row->wiki_rank, 0 ) ) .
|
||||
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( $row->page_count ) .
|
||||
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( $row->rev_count ) .
|
||||
"\n</td><td class='content'>" .
|
||||
$userLink;
|
||||
|
||||
# Option to not display user tools
|
||||
if ( !in_array( 'notools', $opts ) ) {
|
||||
$output .= Linker::userToolLinks( $row->user_id, $row->user_name );
|
||||
}
|
||||
|
||||
$output .= Html::closeElement( 'td' ) . "\n";
|
||||
|
||||
if ( $altrow == '' && empty( $sortable ) ) {
|
||||
$altrow = 'odd ';
|
||||
} else {
|
||||
$altrow = '';
|
||||
}
|
||||
|
||||
$user_rank++;
|
||||
}
|
||||
$output .= Html::closeElement( 'tr' );
|
||||
$output .= Html::closeElement( 'table' );
|
||||
|
||||
$dbr->freeResult( $res );
|
||||
|
||||
if ( !empty( $title ) ) {
|
||||
$output = Html::rawElement( 'table',
|
||||
[
|
||||
'style' => 'border-spacing: 0; padding: 0',
|
||||
'class' => 'contributionscores-wrapper',
|
||||
'lang' => htmlspecialchars( $lang->getCode() ),
|
||||
'dir' => $lang->getDir()
|
||||
],
|
||||
"\n" .
|
||||
"<tr>\n" .
|
||||
"<td style='padding: 0px;'>{$title}</td>\n" .
|
||||
"</tr>\n" .
|
||||
"<tr>\n" .
|
||||
"<td style='padding: 0px;'>{$output}</td>\n" .
|
||||
"</tr>\n"
|
||||
);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function execute( $par ) {
|
||||
$this->setHeaders();
|
||||
|
||||
if ( $this->including() ) {
|
||||
$this->showInclude( $par );
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when being included on a normal wiki page.
|
||||
* Cache is disabled so it can depend on the user language.
|
||||
* @param string|null $par A subpage give to the special page
|
||||
*/
|
||||
function showInclude( $par ) {
|
||||
$days = null;
|
||||
$limit = null;
|
||||
$options = 'none';
|
||||
|
||||
if ( !empty( $par ) ) {
|
||||
$params = explode( '/', $par );
|
||||
|
||||
$limit = intval( $params[0] );
|
||||
|
||||
if ( isset( $params[1] ) ) {
|
||||
$days = intval( $params[1] );
|
||||
}
|
||||
|
||||
if ( isset( $params[2] ) ) {
|
||||
$options = $params[2];
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $limit ) || $limit < 1 || $limit > CONTRIBUTIONSCORES_MAXINCLUDELIMIT ) {
|
||||
$limit = 10;
|
||||
}
|
||||
if ( is_null( $days ) || $days < 0 ) {
|
||||
$days = 7;
|
||||
}
|
||||
|
||||
if ( $days > 0 ) {
|
||||
$reportTitle = $this->msg( 'contributionscores-days' )->numParams( $days )->text();
|
||||
} else {
|
||||
$reportTitle = $this->msg( 'contributionscores-allrevisions' )->text();
|
||||
}
|
||||
$reportTitle .= ' ' . $this->msg( 'contributionscores-top' )->numParams( $limit )->text();
|
||||
$title = Xml::element( 'h4',
|
||||
[ 'class' => 'contributionscores-title' ],
|
||||
$reportTitle
|
||||
) . "\n";
|
||||
$this->getOutput()->addHTML( $this->genContributionScoreTable(
|
||||
$days,
|
||||
$limit,
|
||||
$title,
|
||||
$options
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the special page
|
||||
*/
|
||||
function showPage() {
|
||||
global $wgContribScoreReports;
|
||||
|
||||
if ( !is_array( $wgContribScoreReports ) ) {
|
||||
$wgContribScoreReports = [
|
||||
[ 7, 50 ],
|
||||
[ 30, 50 ],
|
||||
[ 0, 50 ]
|
||||
];
|
||||
}
|
||||
|
||||
$out = $this->getOutput();
|
||||
$out->addWikiMsg( 'contributionscores-info' );
|
||||
|
||||
foreach ( $wgContribScoreReports as $scoreReport ) {
|
||||
list( $days, $revs ) = $scoreReport;
|
||||
if ( $days > 0 ) {
|
||||
$reportTitle = $this->msg( 'contributionscores-days' )->numParams( $days )->text();
|
||||
} else {
|
||||
$reportTitle = $this->msg( 'contributionscores-allrevisions' )->text();
|
||||
}
|
||||
$reportTitle .= ' ' . $this->msg( 'contributionscores-top' )->numParams( $revs )->text();
|
||||
$title = Xml::element( 'h2',
|
||||
[ 'class' => 'contributionscores-title' ],
|
||||
$reportTitle
|
||||
) . "\n";
|
||||
$out->addHTML( $title );
|
||||
$out->addHTML( $this->genContributionScoreTable( $days, $revs ) );
|
||||
}
|
||||
}
|
||||
|
||||
protected function getGroupName() {
|
||||
return 'wiki';
|
||||
}
|
||||
}
|
19
Gruntfile.js
19
Gruntfile.js
|
@ -1,29 +1,26 @@
|
|||
/*jshint node:true */
|
||||
/* eslint-env node, es6 */
|
||||
module.exports = function ( grunt ) {
|
||||
'use strict';
|
||||
|
||||
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
||||
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
||||
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
||||
grunt.loadNpmTasks( 'grunt-eslint' );
|
||||
|
||||
grunt.initConfig( {
|
||||
jshint: {
|
||||
all: [
|
||||
'*.js'
|
||||
]
|
||||
},
|
||||
banana: {
|
||||
all: 'i18n'
|
||||
},
|
||||
jsonlint: {
|
||||
eslint: {
|
||||
options: {
|
||||
cache: true
|
||||
},
|
||||
all: [
|
||||
'**/*.json',
|
||||
'**/*.{js,json}',
|
||||
'!node_modules/**',
|
||||
'!vendor/**'
|
||||
]
|
||||
}
|
||||
} );
|
||||
|
||||
grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana' ] );
|
||||
grunt.registerTask( 'test', [ 'eslint', 'banana' ] );
|
||||
grunt.registerTask( 'default', 'test' );
|
||||
};
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
{
|
||||
"require-dev": {
|
||||
"jakub-onderka/php-parallel-lint": "1.0.0",
|
||||
"mediawiki/mediawiki-codesniffer": "26.0.0",
|
||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"mediawiki/minus-x": "0.3.1"
|
||||
"mediawiki/mediawiki-codesniffer": "45.0.0",
|
||||
"mediawiki/minus-x": "1.1.3",
|
||||
"php-parallel-lint/php-console-highlighter": "1.0.0",
|
||||
"php-parallel-lint/php-parallel-lint": "1.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"fix": [
|
||||
"phpcbf",
|
||||
"minus-x fix ."
|
||||
"minus-x fix .",
|
||||
"phpcbf"
|
||||
],
|
||||
"test": [
|
||||
"parallel-lint . --exclude vendor --exclude node_modules",
|
||||
"phpcs -p -s",
|
||||
"@phpcs",
|
||||
"minus-x check ."
|
||||
]
|
||||
],
|
||||
"phpcs": "phpcs -sp --cache"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
64
extension.json
Normal file
64
extension.json
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"name": "ContributionScores",
|
||||
"author": "Tim Laqua",
|
||||
"url": "https://www.mediawiki.org/wiki/Extension:Contribution_Scores",
|
||||
"descriptionmsg": "contributionscores-desc",
|
||||
"version": "1.26.1",
|
||||
"type": "specialpage",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.34.0"
|
||||
},
|
||||
"SpecialPages": {
|
||||
"ContributionScores": "ContributionScores"
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"ContributionScores": "src/ContributionScores.php"
|
||||
},
|
||||
"Hooks": {
|
||||
"ParserFirstCallInit": "ContributionScores::onParserFirstCallInit"
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"ContributionScores": [
|
||||
"i18n"
|
||||
]
|
||||
},
|
||||
"ExtensionMessagesFiles": {
|
||||
"ContribScoreAlias": "ContributionScores.alias.php",
|
||||
"ContribScoreMagic": "ContributionScores.i18n.magic.php"
|
||||
},
|
||||
"config": {
|
||||
"ContribScoreReports": {
|
||||
"value": null,
|
||||
"description": "Each array defines a report - 7,50 is \"past 7 days \" and \"LIMIT 50 \" - Can be omitted."
|
||||
},
|
||||
"ContribScoreIgnoreBlockedUsers": {
|
||||
"value": false,
|
||||
"description": "Set to true to exclude blocked users from the reporting."
|
||||
},
|
||||
"ContribScoreIgnoreBots": {
|
||||
"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."
|
||||
},
|
||||
"ContribScoreDisableCache": {
|
||||
"value": false,
|
||||
"description": "Set to true to disable cache for parser function and inclusion of table."
|
||||
},
|
||||
"ContribScoreUseRoughEditCount": {
|
||||
"value": false,
|
||||
"description": "Set to true to use the rough number of edits in user table, for performance issue."
|
||||
},
|
||||
"ContribScoreCacheTTL": {
|
||||
"value": 30,
|
||||
"description": "Cache the contribution scores data, in minutes."
|
||||
}
|
||||
},
|
||||
"manifest_version": 2
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Mousa",
|
||||
"Alp Er Tunqa"
|
||||
"Alp Er Tunqa",
|
||||
"Mousa"
|
||||
]
|
||||
},
|
||||
"contributionscores": "چالیشماق امتیازلاری",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Bellayet",
|
||||
"Wikitanvir",
|
||||
"Aftab1995",
|
||||
"Aftabuzzaman",
|
||||
"Bellayet",
|
||||
"Wikitanvir",
|
||||
"আফতাবুজ্জামান"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"authors": [
|
||||
"CERminator",
|
||||
"KWiki",
|
||||
"Srdjan m"
|
||||
"Srdjan m",
|
||||
"Srđan"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Rezultat doprinosa",
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
"Byrial",
|
||||
"Christian List",
|
||||
"Kaare",
|
||||
"Peter Alberti"
|
||||
"Peter Alberti",
|
||||
"Saederup92"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Bidragspoint",
|
||||
|
@ -14,6 +15,7 @@
|
|||
"contributionscores-days": "Sidste {{PLURAL:$1|dag|$1 dage}}",
|
||||
"contributionscores-allrevisions": "Gennem tiden",
|
||||
"contributionscores-score": "Point",
|
||||
"contributionscores-rank": "Rang",
|
||||
"contributionscores-pages": "Sider",
|
||||
"contributionscores-changes": "Ændringer",
|
||||
"contributionscores-username": "Brugernavn",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
]
|
||||
},
|
||||
"contributionscores": "Statistik zu Benutzern",
|
||||
"contributionscores-desc": "Ergänzt eine [[Special:ContributionScores|Spezialseite]] zum Abfragen der Datenbank des Wikis bezüglich der Benutzer mit den meisten Beiträgen",
|
||||
"contributionscores-desc": "Erweitert das Wiki um eine [[Special:ContributionScores|Spezialseite]] zum Ermitteln der Benutzer mit den meisten Beiträgen",
|
||||
"contributionscores-info": "In die Bewertung fließen hauptsächlich einmalig bearbeitete Seiten unter Berücksichtigung einer hohen Bearbeitungszahl ein.",
|
||||
"contributionscores-top": "(Top $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Letzter Tag|Letzte $1 Tage}}",
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Erdemaslancan",
|
||||
"Mirzali",
|
||||
"Marmase"
|
||||
"Marmase",
|
||||
"Mirzali"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Skorê iştıraqan",
|
||||
|
@ -11,7 +11,7 @@
|
|||
"contributionscores-info": "Ebe pawıtışê hecmê tedqiqê berzi ra, puwan raveri pelanê bêemsalanê vurniyayeyan senceno.",
|
||||
"contributionscores-top": "(Tewr Gırde $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Roca peyêne|$1 Rocê peyêni}}",
|
||||
"contributionscores-allrevisions": "Çaxan de hemi",
|
||||
"contributionscores-allrevisions": "Her dem",
|
||||
"contributionscores-score": "Puwan",
|
||||
"contributionscores-rank": "Rêze",
|
||||
"contributionscores-pages": "Peli",
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"Consta",
|
||||
"Crazymadlover",
|
||||
"Omnipaedista",
|
||||
"ZaDiak",
|
||||
"Protnet"
|
||||
"Protnet",
|
||||
"ZaDiak"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Βαθμολογίες συνεισφοράς",
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
"contributionscores-username": "Username",
|
||||
"contributionscores-invalidusername": "Invalid username",
|
||||
"contributionscores-invalidmetric": "Invalid metric"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Michawiki",
|
||||
"Yekrats",
|
||||
"Mirin",
|
||||
"Robin van der Vliet",
|
||||
"Mirin"
|
||||
"Yekrats"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Poentaro de Kontribuoj",
|
||||
|
@ -18,6 +18,6 @@
|
|||
"contributionscores-pages": "Paĝoj",
|
||||
"contributionscores-changes": "Ŝanĝoj",
|
||||
"contributionscores-username": "Uzantnomo",
|
||||
"contributionscores-invalidusername": "Nevalida salutnomo",
|
||||
"contributionscores-invalidusername": "Nevalida uzantnomo",
|
||||
"contributionscores-invalidmetric": "Nevalida parametro"
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"Fitoschido",
|
||||
"Ihojose",
|
||||
"Imre",
|
||||
"Sanbec",
|
||||
"Macofe"
|
||||
"Macofe",
|
||||
"Sanbec"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Puntuaciones de contribuciones",
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Better"
|
||||
]
|
||||
},
|
||||
"contributionscores-days": "Úrtimus $1 dias"
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Alirezaaa",
|
||||
"Ebraminio",
|
||||
"Huji",
|
||||
"Mjbmr",
|
||||
"Reza1615",
|
||||
"Tofighi",
|
||||
"ZxxZxxZ",
|
||||
"Alirezaaa"
|
||||
"ZxxZxxZ"
|
||||
]
|
||||
},
|
||||
"contributionscores": "امتیاز مشارکت",
|
||||
|
|
11
i18n/fi.json
11
i18n/fi.json
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"01miki10",
|
||||
"Crt",
|
||||
"Nike",
|
||||
"Str4nd",
|
||||
"Stryn",
|
||||
"Pxos",
|
||||
"Pyscowicz"
|
||||
"Pyscowicz",
|
||||
"Str4nd",
|
||||
"Stryn"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Muokkauspisteet",
|
||||
|
@ -18,7 +19,7 @@
|
|||
"contributionscores-rank": "Sija",
|
||||
"contributionscores-pages": "Sivuja",
|
||||
"contributionscores-changes": "Muutoksia",
|
||||
"contributionscores-username": "Käyttäjätunnus",
|
||||
"contributionscores-invalidusername": "Virheellinen käyttäjätunnus",
|
||||
"contributionscores-username": "Käyttäjänimi",
|
||||
"contributionscores-invalidusername": "Virheellinen käyttäjänimi",
|
||||
"contributionscores-invalidmetric": "Virheellinen muuttuja"
|
||||
}
|
||||
|
|
8
i18n/fit.json
Normal file
8
i18n/fit.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Pyscowicz"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Mookkauspisteet"
|
||||
}
|
|
@ -21,6 +21,6 @@
|
|||
"contributionscores-pages": "Pages",
|
||||
"contributionscores-changes": "Changements",
|
||||
"contributionscores-username": "Nom d’utilisateur",
|
||||
"contributionscores-invalidusername": "Nom d’utilisateur invalide",
|
||||
"contributionscores-invalidusername": "Nom d’utilisateur incorrect",
|
||||
"contributionscores-invalidmetric": "Métrique incorrecte"
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Snakesteuben",
|
||||
"Robin0van0der0vliet",
|
||||
"PiefPafPier",
|
||||
"Robin van der Vliet",
|
||||
"PiefPafPier"
|
||||
"Robin0van0der0vliet",
|
||||
"Snakesteuben"
|
||||
]
|
||||
},
|
||||
"contributionscores-username": "Meidochnamme"
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"authors": [
|
||||
"Ansumang",
|
||||
"Kaustubh",
|
||||
"Siddhartha Ghai",
|
||||
"Sfic"
|
||||
"Sfic",
|
||||
"Siddhartha Ghai"
|
||||
]
|
||||
},
|
||||
"contributionscores": "योगदान संख्या",
|
||||
|
|
10
i18n/hr.json
10
i18n/hr.json
|
@ -3,19 +3,21 @@
|
|||
"authors": [
|
||||
"Dalibor Bosits",
|
||||
"Ex13",
|
||||
"MaGa",
|
||||
"SpeedyGonsales"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Najbolji suradnici",
|
||||
"contributionscores-desc": "Šalje upit bazi podataka za najveći [[Special:ContributionScores|broj suradničkih doprinosa]]",
|
||||
"contributionscores-info": "Rezultat se dobiva kao suma slijedećih stavki:\n*1 bod za svaku stranicu koju ste uređivali\n* (kvadratni) korijen iz (broja ukupnih uređivanja) - (broja stranica koje ste uređivali) * 2\n\nRezultat dobiven na ovaj način daje veću težinu broju uređivanja različitih stranica nego ukupnom broju uređivanja. U osnovi, ovakav rezultat mjeri prvenstveno broj različitih stranica koje ste uređivali, uzimajući u obzir broj uređivanja, jer veći broj uređivanja na nekom članku daje kvalitetniji članak.",
|
||||
"contributionscores-top": "(Najboljih $1)",
|
||||
"contributionscores-info": "U prvom planu rezultat mjeri jedinstvene izmijenjene stranice, uzimajući u obzir veliku količinu uređivanja.",
|
||||
"contributionscores-top": "(najboljih $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Zadnji dan|Zadnjih $1 dana}}",
|
||||
"contributionscores-allrevisions": "Sva uređivanja",
|
||||
"contributionscores-allrevisions": "Sve vrijeme",
|
||||
"contributionscores-score": "Rezultat",
|
||||
"contributionscores-rank": "Mjesto",
|
||||
"contributionscores-pages": "Stranica",
|
||||
"contributionscores-changes": "Uređivanja",
|
||||
"contributionscores-username": "Ime suradnika",
|
||||
"contributionscores-username": "Suradničko ime",
|
||||
"contributionscores-invalidusername": "Nevaljano suradničko ime",
|
||||
"contributionscores-invalidmetric": "Nevaljana metrika"
|
||||
}
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
},
|
||||
"contributionscores": "Contes de contribution",
|
||||
"contributionscores-desc": "Calcula li funde de data del wiki por max alt [[Special:ContributionScores|volúmine de contribution de usator]]",
|
||||
"contributionscores-info": "Contes es calculat quam seque:\n*Un (1) punctu por chascun págine unic redactet\n*Fonte de quadrat de (total de redactiones fat) - (total unique pages) * 2\nContes calculat in ti diversitá de redaction in pesa maniere súper de volúmine de redaction.\nBasicmen, ti conte mesura primarimen págines unic redactet, che consideration por alt volúmine de redaction - suposit esser un págine de alt qualitá.",
|
||||
"contributionscores-info": "Li calcul primarimen mesura págines unic redactet, considerant li alt volume de redactiones.",
|
||||
"contributionscores-top": "(Prim $1)",
|
||||
"contributionscores-days": "Ultim {{PLURAL:$1|die|$1 dies}}",
|
||||
"contributionscores-allrevisions": "Omni témpor",
|
||||
"contributionscores-score": "Conte",
|
||||
"contributionscores-rank": "Classification",
|
||||
"contributionscores-pages": "Págines",
|
||||
"contributionscores-changes": "Changes",
|
||||
"contributionscores-username": "Nómine de usator",
|
||||
|
|
|
@ -5,5 +5,8 @@
|
|||
]
|
||||
},
|
||||
"contributionscores-days": "Lasta {{PLURAL:$1|dio|$1 dii}}",
|
||||
"contributionscores-pages": "Pagini"
|
||||
"contributionscores-score": "Nombro di punti",
|
||||
"contributionscores-pages": "Pagini",
|
||||
"contributionscores-changes": "Modifikuri",
|
||||
"contributionscores-username": "Uzeronomo"
|
||||
}
|
||||
|
|
10
i18n/jv.json
10
i18n/jv.json
|
@ -1,13 +1,15 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Diki Ananta",
|
||||
"Meursault2004",
|
||||
"NoiX180",
|
||||
"Pras",
|
||||
"NoiX180"
|
||||
"Sumbukompor"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Bijining pasumbang",
|
||||
"contributionscores-desc": "Nglakokaké polling (angkèt) ing basis data kanggo [[Special:ContributionScores|volume kontribusi panganggo]]",
|
||||
"contributionscores-desc": "Nglakokaké polling (angkèt) ing basis data kanggo [[Special:ContributionScores|volume kontribusi naraguna]]",
|
||||
"contributionscores-info": "Skoré diétung kaya mangkéné:\n* Biji siji (1) per kaca unik sing disunting\n* Oyot (bs. Indonesia ''akar'') saka (Gunggungé Suntingan) - (Gunggungé Kaca-KAca Unik) * 2\nSkor sing diétung miturut cara iki bisa nyerminaké divèrsitas suntingan sadhuwuring volume suntingan.\nSacara dhasar, skor iki utamané ngétung kaca-kaca unik sing disunting, karo mélu nimbangaké volume suntingan dhuwur - diasumsèkaké kwalitas kacané luwih dhuwur.",
|
||||
"contributionscores-top": "(Top $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|dina|$1 dina}} pungkasan",
|
||||
|
@ -16,7 +18,7 @@
|
|||
"contributionscores-rank": "Rangking",
|
||||
"contributionscores-pages": "Kaca",
|
||||
"contributionscores-changes": "Owah-owahan",
|
||||
"contributionscores-username": "Jeneng panganggo",
|
||||
"contributionscores-invalidusername": "Jeneng panganggo ora sah",
|
||||
"contributionscores-username": "Jeneng naraguna",
|
||||
"contributionscores-invalidusername": "Jeneng naraguna ora sah",
|
||||
"contributionscores-invalidmetric": "Metrik ora sah"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"@metadata": [],
|
||||
"@metadata": {
|
||||
"authors": []
|
||||
},
|
||||
"contributionscores": "Üles berw esepteri",
|
||||
"contributionscores-info": "Esepter kelesi deý sanaladı:\n*1 upaý ärbir tüzetilgen biregeý bet üşin\n*Mınanıñ şarşı tübiri (Barlıq İstelingen Tüzetwler) ‒ (Barlıq Biregeý Better) * 2\nOsı täsilmen sanalğan esepter tüzetw awqımındağı öñdew ärkelkiliginiñ salmağın ölşeýdi. Negizinde, bul esep aldımen tüzetilgen birkelki betterdi ölşeýdi, joğarğı öñdew awqımımen birge — joğarı sapalı bet jağdaýımen eseptep.",
|
||||
"contributionscores-top": "(Joğarğı $1)",
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
"authors": [
|
||||
"Hym411",
|
||||
"Priviet",
|
||||
"Revi",
|
||||
"Shirayuki",
|
||||
"아라",
|
||||
"Revi"
|
||||
"아라"
|
||||
]
|
||||
},
|
||||
"contributionscores": "기여 점수",
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Balyozxane",
|
||||
"George Animal"
|
||||
]
|
||||
},
|
||||
"contributionscores-allrevisions": "Hemû dem",
|
||||
"contributionscores-pages": "Rûpel",
|
||||
"contributionscores-changes": "Guhartin",
|
||||
"contributionscores-username": "Navê bikarhêner"
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
]
|
||||
},
|
||||
"contributionscores": "Bewäertung vun den Ännerungen",
|
||||
"contributionscores-desc": "Ufro un d'Wiki-Datebank no den héichste [[Special:ContributionScores|Benotzerscoren]]",
|
||||
"contributionscores-desc": "Ufro un d'Wiki-Datebank no den héchste [[Special:ContributionScores|Benotzerscoren]]",
|
||||
"contributionscores-info": "D'Bewäertung moosst Zuel vu geännerte Säite a consideréiert d'Zuel vun den Ännerungen.",
|
||||
"contributionscores-top": "(Top $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Leschten Dag|Lescht $1 Deeg}}",
|
||||
|
|
8
i18n/lij.json
Normal file
8
i18n/lij.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Giromin Cangiaxo"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Pontezzi contributi"
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
"contributionscores": "Оцени за придонеси",
|
||||
"contributionscores-desc": "Презема податоци од викибазата за [[Special:ContributionScores|корисници со највеќе придонеси]]",
|
||||
"contributionscores-info": "Салдото е мерка што изразува уредувања на засебни страници, со оглед на големиот број на уредувања.",
|
||||
"contributionscores-info": "Салдото е мерка што изразува уредувања на одделни страници, со оглед на големиот број на уредувања.",
|
||||
"contributionscores-top": "(Најдобри $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Последниот ден|Последните $1 дена}}",
|
||||
"contributionscores-allrevisions": "На сите времиња",
|
||||
|
@ -16,5 +16,5 @@
|
|||
"contributionscores-changes": "Измени",
|
||||
"contributionscores-username": "Корисничко име",
|
||||
"contributionscores-invalidusername": "Неправилно корисничко име",
|
||||
"contributionscores-invalidmetric": "Грешна метрика"
|
||||
"contributionscores-invalidmetric": "Грешно мерило"
|
||||
}
|
||||
|
|
13
i18n/mni.json
Normal file
13
i18n/mni.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Awangba Mangang"
|
||||
]
|
||||
},
|
||||
"contributionscores-allrevisions": "ꯃꯇꯝ ꯄꯨꯂꯞ",
|
||||
"contributionscores-rank": "ꯊꯥꯛ",
|
||||
"contributionscores-pages": "ꯂꯃꯥꯏꯁꯤꯡ",
|
||||
"contributionscores-changes": "ꯑꯍꯣꯡꯕꯁꯤꯡ",
|
||||
"contributionscores-username": "ꯁꯤꯖꯤꯟꯅꯔꯤꯕ ꯃꯃꯤꯡ",
|
||||
"contributionscores-invalidusername": "ꯁꯤꯖꯤꯟꯅꯔꯤꯕ ꯃꯃꯤꯡ ꯌꯥꯎꯗꯦ"
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Ninjastrikers",
|
||||
"Dr Lotus Black"
|
||||
"Dr Lotus Black",
|
||||
"Ninjastrikers"
|
||||
]
|
||||
},
|
||||
"contributionscores": "ပံ့ပို့မှု ရမှတ်များ",
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Akapochtli",
|
||||
"Fluence"
|
||||
]
|
||||
},
|
||||
"contributionscores-changes": "Tlapatlaliztli",
|
||||
"contributionscores-username": "Tlatequitiltilīltōcāitl"
|
||||
"contributionscores-username": "Tequitiuhcatocaitll"
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Nghtwlkr",
|
||||
"Helland",
|
||||
"Danmichaelo",
|
||||
"Jon Harald Søby"
|
||||
"Helland",
|
||||
"Jon Harald Søby",
|
||||
"Nghtwlkr"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Bidragspoeng",
|
||||
|
|
13
i18n/ne.json
13
i18n/ne.json
|
@ -1,8 +1,17 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"RajeshPandey"
|
||||
"RajeshPandey",
|
||||
"पर्वत सुबेदी"
|
||||
]
|
||||
},
|
||||
"contributionscores-username": "प्रयोगकर्ता नाम"
|
||||
"contributionscores": "योगदान प्राप्ताङ्कहरू",
|
||||
"contributionscores-days": "अन्तिम {{PLURAL:$1|दिन|$1 दिनहरू}}",
|
||||
"contributionscores-allrevisions": "सबै समय",
|
||||
"contributionscores-score": "प्राप्ताङ्क",
|
||||
"contributionscores-rank": "क्रम",
|
||||
"contributionscores-pages": "पृष्ठहरू",
|
||||
"contributionscores-changes": "परिवर्तनहरू",
|
||||
"contributionscores-username": "प्रयोगकर्ता नाम",
|
||||
"contributionscores-invalidusername": "अबैध प्रयोगकर्ता नाम"
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
"Derbeth",
|
||||
"Equadus",
|
||||
"McMonster",
|
||||
"Sp5uhe",
|
||||
"Wpedzich",
|
||||
"Rail",
|
||||
"Railfail536",
|
||||
"Rail"
|
||||
"Sp5uhe",
|
||||
"Wpedzich"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Punkty za edycje",
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Abbas dhothar",
|
||||
"BukhariSaeed"
|
||||
]
|
||||
},
|
||||
"contributionscores-days": "پچھلے{{PLURAL:$1|دن|$1 دناں}}",
|
||||
"contributionscores-changes": "تبدیلیاں",
|
||||
"contributionscores-username": "ورتن آلے دا ناں"
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Ahmed-Najib-Biabani-Ibrahimkhel",
|
||||
"Baloch Khan",
|
||||
"Amjad Khan"
|
||||
"Amjad Khan",
|
||||
"Baloch Khan"
|
||||
]
|
||||
},
|
||||
"contributionscores-days": "وروستۍ {{PLURAL:$1|ورځ|$1 ورځې}}",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"!Silent",
|
||||
"Brunoy Anastasiya Seryozhenko",
|
||||
"Crazymadlover",
|
||||
"Eduardo.mps",
|
||||
"Giro720",
|
||||
"Luckas",
|
||||
"HenriqueCrang",
|
||||
"!Silent",
|
||||
"Luckas",
|
||||
"Opraco"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Fúlvio",
|
||||
"Hamilton Abreu",
|
||||
"Malafaya",
|
||||
"Waldir",
|
||||
"Vitorvicentevalente",
|
||||
"Fúlvio",
|
||||
"Waldir",
|
||||
"Waldyrious"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
"Jon Harald Søby",
|
||||
"JtFuruhata",
|
||||
"Kalan",
|
||||
"Liuxinyu970226",
|
||||
"Mormegil",
|
||||
"Purodha",
|
||||
"Raymond",
|
||||
"Shirayuki",
|
||||
"Liuxinyu970226",
|
||||
"Tacsipacsi"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Ahonc",
|
||||
"Kaganer",
|
||||
"Kalan",
|
||||
"Lockal",
|
||||
"Okras",
|
||||
"Ole Yves",
|
||||
"Александр Сигачёв",
|
||||
"Kaganer"
|
||||
"Александр Сигачёв"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Оценка вклада",
|
||||
|
|
11
i18n/sk.json
11
i18n/sk.json
|
@ -2,16 +2,19 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Helix84",
|
||||
"Teslaton"
|
||||
"Luky001",
|
||||
"Teslaton",
|
||||
"Yardom78"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Skóre príspevkov",
|
||||
"contributionscores-desc": "Zisťuje naväčší [[Special:ContributionScores|objem používateľských príspevkov]] z databázy wiki",
|
||||
"contributionscores-info": "Skóre sa počíta nasledovne:\n*1 bod za každú jedinečnú stránku, ktorú používateľ upravoval\n*Odmocnina z (celkom úprav) - (celkom jedinečných stránok) * 2\nSkóre vypočítané týmto spôsobom vážia diverzitu úprav viac ako objem úprav. V podstate toto skóre meria najmä počet upravovaných jedinečných stránok s prihliadnutím na vysoký objem úprav; čo sa pokladá za stránku vyššej kvality.",
|
||||
"contributionscores-desc": "Získava údaje z databázy wiki o [[Special:ContributionScores|množstve používateľských príspevkov]]",
|
||||
"contributionscores-info": "Skóre primárne meria jedinečné editované stránky s ohľadom na veľké množstvo úprav.",
|
||||
"contributionscores-top": "(Najlepších $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Posledný $1 deň|Posledné $1 dni|Posledných $1 dní}}",
|
||||
"contributionscores-allrevisions": "Celá história",
|
||||
"contributionscores-allrevisions": "Celkom",
|
||||
"contributionscores-score": "Skóre",
|
||||
"contributionscores-rank": "Poradie",
|
||||
"contributionscores-pages": "Stránky",
|
||||
"contributionscores-changes": "Zmeny",
|
||||
"contributionscores-username": "Používateľské meno",
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Acamicamacaraca",
|
||||
"Kizule",
|
||||
"Milicevic01",
|
||||
"Rancher",
|
||||
"Sasa Stefanovic",
|
||||
"Михајло Анђелковић",
|
||||
"Zoranzoki21",
|
||||
"Acamicamacaraca"
|
||||
"Михајло Анђелковић"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Оцене доприноса",
|
||||
|
|
12
i18n/th.json
12
i18n/th.json
|
@ -1,18 +1,22 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Woraponboonkerd",
|
||||
"Ans"
|
||||
"Aefgh39622",
|
||||
"Ans",
|
||||
"Woraponboonkerd"
|
||||
]
|
||||
},
|
||||
"contributionscores": "คะแนนการแก้ไข",
|
||||
"contributionscores-desc": "จัดอันดับฐานข้อมูลของวิกิสำหรับ[[Special:ContributionScores|ผู้ใ้ช้ที่มีจำนวนการแก้ไขสูงสุด]]",
|
||||
"contributionscores-info": "วิธีการคิดคะแนนเป็นดังต่อไปนี้:\n* หนึ่ง (1) คะแนนต่อจำนวนหน้าที่เข้าร่วมแก้ไข (ชื่อของหน้าไม่ซ้ำกัน)\n* รากที่สองของจำนวนการแก้ไขทั้งหมด - จำนวนหน้าทั้งหมดที่ร่วมแก้ไข * 2\nคะแนนจะถูกคิดโดยให้น้ำหนักของการแก้ไขที่หลากหลายมากกว่าจำนวนการแก้ไข\nโดยทั่วไป คะแนนนี้ชี้วัดถึงจำนวนหน้าต่างๆ ที่เข้าร่วมแก้ไข โดยคำนึงถึงจำนวนการแก้ไขทั้งหมดด้วย จึงคาดการณ์ได้ว่าจะทำให้มีหน้าที่มีคุณภาพสูงขึ้น",
|
||||
"contributionscores-info": "คะแนนคิดจากจำนวนหน้าที่เข้าร่วมแก้ไข พร้อมพิจารณาปริมาณการแก้ไขเป็นหลัก",
|
||||
"contributionscores-top": "($1 อันดับแรก)",
|
||||
"contributionscores-days": "$1 {{PLURAL:$1|วัน|วัน}} ที่แล้ว",
|
||||
"contributionscores-allrevisions": "ตลอดเวลา",
|
||||
"contributionscores-score": "คะแนน",
|
||||
"contributionscores-rank": "การจัดอันดับ",
|
||||
"contributionscores-pages": "จำนวนหน้า",
|
||||
"contributionscores-changes": "การเปลี่ยนแปลง",
|
||||
"contributionscores-username": "ชื่อผู้ใช้",
|
||||
"contributionscores-invalidusername": "ชื่อผู้ใช้ไม่ถูกต้อง"
|
||||
"contributionscores-invalidusername": "ชื่อผู้ใช้ไม่ถูกต้อง",
|
||||
"contributionscores-invalidmetric": "เกณฑ์ชี้วัดไม่ถูกต้อง"
|
||||
}
|
||||
|
|
10
i18n/ti.json
Normal file
10
i18n/ti.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Joanmp17"
|
||||
]
|
||||
},
|
||||
"contributionscores-pages": "ገጻት",
|
||||
"contributionscores-changes": "ለውጥታት",
|
||||
"contributionscores-username": "ስም ተጠቃሚ"
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Hedda",
|
||||
"Joseph",
|
||||
"Karduelis",
|
||||
"Mach",
|
||||
"Suelnur",
|
||||
"Vito Genovese",
|
||||
"Hedda"
|
||||
"Vito Genovese"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Katkı puanları",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Ерней",
|
||||
"Ильнар"
|
||||
]
|
||||
},
|
||||
|
@ -10,10 +11,10 @@
|
|||
"contributionscores-top": "(Иң әйбәт $1)",
|
||||
"contributionscores-days": "Соңгы {{PLURAL:$1|$1 көн өчен}}",
|
||||
"contributionscores-allrevisions": "Бөтен вакыт өчен",
|
||||
"contributionscores-score": "Билге",
|
||||
"contributionscores-score": "Бәя",
|
||||
"contributionscores-rank": "Ранг",
|
||||
"contributionscores-pages": "Битләр саны",
|
||||
"contributionscores-changes": "Үзгәртүләр",
|
||||
"contributionscores-pages": "Битләр",
|
||||
"contributionscores-changes": "Төзәтмәләр",
|
||||
"contributionscores-username": "Кулланучы исеме",
|
||||
"contributionscores-invalidusername": "Кулланучының исеме дөрес түгел",
|
||||
"contributionscores-invalidmetric": "Ялгыш билгеләү"
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Candalua"
|
||||
"Candalua",
|
||||
"Fierodelveneto"
|
||||
]
|
||||
},
|
||||
"contributionscores": "Puntegi contributi",
|
||||
"contributionscores": "Ponteji contribusion",
|
||||
"contributionscores-desc": "Intèroga el database de la wiki par el pi grando [[Special:ContributionScores|volume de contributi utente]]",
|
||||
"contributionscores-info": "I punti i vien calcolà come segue:\n*Un (1) punto par ogni diversa pagina modificà\n*Raìsa quadrata de (Tute le modifiche fate) - (Total de le pagine modificà) * 2\nFasendo i conti in sta maniera pesa piassè la diversità de le modifiche rispeto al nùmaro dei contributi.\nIn sostansa, sto puntegio el tien conto sopratuto de le diverse pagine modificà, tegnendo in considerazion anca un alto volume de modifiche - che fa pensar a na pi alta qualità de la pagina modificà.",
|
||||
"contributionscores-top": "(Ultimi $1)",
|
||||
"contributionscores-days": "{{PLURAL:$1|Ultimo zòrno|Ultimi $1 zòrni}}",
|
||||
"contributionscores-allrevisions": "Tute le revision",
|
||||
"contributionscores-score": "Puntegio",
|
||||
"contributionscores-pages": "Pagine",
|
||||
"contributionscores-pages": "Pàjine",
|
||||
"contributionscores-changes": "Canbiamenti",
|
||||
"contributionscores-username": "Nome utente",
|
||||
"contributionscores-invalidusername": "Nome utente mia valido",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"@metadata": {
|
||||
"authors": [
|
||||
"Minh Nguyen",
|
||||
"Phjtieudoc",
|
||||
"Vinhtantran"
|
||||
]
|
||||
},
|
||||
|
@ -13,7 +14,7 @@
|
|||
"contributionscores-allrevisions": "Từ trước đến nay",
|
||||
"contributionscores-score": "Điểm số",
|
||||
"contributionscores-pages": "Trang",
|
||||
"contributionscores-changes": "Các thay đổi",
|
||||
"contributionscores-changes": "Thay đổi",
|
||||
"contributionscores-username": "Tên người dùng",
|
||||
"contributionscores-invalidusername": "Tên người dùng không hợp lệ",
|
||||
"contributionscores-invalidmetric": "Chuẩn đo không hợp lệ"
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Moon0319",
|
||||
"PhiLiP",
|
||||
"Roy17",
|
||||
"Shinjiman",
|
||||
"Shirayuki",
|
||||
"Yueman"
|
||||
|
@ -12,7 +14,7 @@
|
|||
"contributionscores-info": "呢個分數係會依主要嘅唯一編輯過嘅頁,同埋考慮高編輯量。",
|
||||
"contributionscores-top": "(最高$1名)",
|
||||
"contributionscores-days": "最近$1日",
|
||||
"contributionscores-allrevisions": "全部時間",
|
||||
"contributionscores-allrevisions": "有史以來",
|
||||
"contributionscores-score": "分數",
|
||||
"contributionscores-rank": "等級",
|
||||
"contributionscores-pages": "版",
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
{
|
||||
"@metadata": {
|
||||
"authors": [
|
||||
"Cwlin0416",
|
||||
"Kly",
|
||||
"LNDDYL",
|
||||
"Liuxinyu970226",
|
||||
"Mark85296341",
|
||||
"PhiLiP",
|
||||
"Shinjiman",
|
||||
"Shirayuki",
|
||||
"Simon Shek",
|
||||
"Cwlin0416",
|
||||
"Liuxinyu970226",
|
||||
"LNDDYL",
|
||||
"Kly"
|
||||
"Simon Shek"
|
||||
]
|
||||
},
|
||||
"contributionscores": "貢獻分數",
|
||||
|
|
7752
package-lock.json
generated
7752
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"name": "ContributionScores",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"test": "grunt test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "1.0.4",
|
||||
"grunt-banana-checker": "0.4.0",
|
||||
"grunt-contrib-jshint": "0.11.3",
|
||||
"grunt-jscs": "2.5.0",
|
||||
"grunt-jsonlint": "1.0.7"
|
||||
"eslint-config-wikimedia": "0.28.2",
|
||||
"grunt": "1.6.1",
|
||||
"grunt-banana-checker": "0.13.0",
|
||||
"grunt-eslint": "24.3.0"
|
||||
}
|
||||
}
|
||||
|
|
436
src/ContributionScores.php
Normal file
436
src/ContributionScores.php
Normal file
|
@ -0,0 +1,436 @@
|
|||
<?php
|
||||
/** \file
|
||||
* \brief Contains code for the ContributionScores Class (extends SpecialPage).
|
||||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/// Special page class for the Contribution Scores extension
|
||||
/**
|
||||
* Special page that generates a list of wiki contributors based
|
||||
* on edit diversity (unique pages edited) and edit volume (total
|
||||
* number of edits.
|
||||
*
|
||||
* @ingroup Extensions
|
||||
* @author Tim Laqua <t.laqua@gmail.com>
|
||||
*/
|
||||
class ContributionScores extends IncludableSpecialPage {
|
||||
const CONTRIBUTIONSCORES_MAXINCLUDELIMIT = 50;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct( 'ContributionScores' );
|
||||
}
|
||||
|
||||
public static function onParserFirstCallInit( Parser $parser ) {
|
||||
$parser->setFunctionHook( 'cscore', [ self::class, 'efContributionScoresRender' ] );
|
||||
}
|
||||
|
||||
public static function efContributionScoresRender( $parser, $usertext, $metric = 'score' ) {
|
||||
global $wgContribScoreDisableCache, $wgContribScoreUseRoughEditCount;
|
||||
|
||||
if ( $wgContribScoreDisableCache ) {
|
||||
$parser->getOutput()->updateCacheExpiry( 0 );
|
||||
}
|
||||
|
||||
$user = User::newFromName( $usertext );
|
||||
$loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
|
||||
$dbr = $loadBalancer->getConnection( DB_REPLICA );
|
||||
|
||||
if ( $user instanceof User && $user->isRegistered() ) {
|
||||
global $wgLang;
|
||||
$revVar = $wgContribScoreUseRoughEditCount ? 'user_editcount' : 'COUNT(rev_id)';
|
||||
|
||||
$revWhere = ActorMigration::newMigration()->getWhere( $dbr, 'rev_user', $user );
|
||||
if ( $metric == 'score' ) {
|
||||
$row = $dbr->selectRow(
|
||||
[ 'revision' ] + $revWhere['tables'],
|
||||
[ 'wiki_rank' => "COUNT(DISTINCT rev_page)+SQRT($revVar-COUNT(DISTINCT rev_page))*2" ],
|
||||
$revWhere['conds'],
|
||||
__METHOD__,
|
||||
[],
|
||||
$revWhere['joins']
|
||||
);
|
||||
$output = $wgLang->formatNum( round( $row->wiki_rank, 0 ) );
|
||||
} elseif ( $metric == 'changes' ) {
|
||||
$row = $dbr->selectRow(
|
||||
[ 'revision' ] + $revWhere['tables'],
|
||||
[ 'rev_count' => $revVar ],
|
||||
$revWhere['conds'],
|
||||
__METHOD__,
|
||||
[],
|
||||
$revWhere['joins']
|
||||
);
|
||||
$output = $wgLang->formatNum( $row->rev_count );
|
||||
} elseif ( $metric == 'pages' ) {
|
||||
$row = $dbr->selectRow(
|
||||
[ 'revision' ] + $revWhere['tables'],
|
||||
[ 'page_count' => 'COUNT(DISTINCT rev_page)' ],
|
||||
$revWhere['conds'],
|
||||
__METHOD__,
|
||||
[],
|
||||
$revWhere['joins']
|
||||
);
|
||||
$output = $wgLang->formatNum( $row->page_count );
|
||||
} else {
|
||||
$output = wfMessage( 'contributionscores-invalidmetric' )->text();
|
||||
}
|
||||
} else {
|
||||
$output = wfMessage( 'contributionscores-invalidusername' )->text();
|
||||
}
|
||||
return $parser->insertStripItem( $output, $parser->getStripState() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function fetch Contribution Scores data from database
|
||||
*
|
||||
* @param int $days Days in the past to run report for
|
||||
* @param int $limit Maximum number of users to return (default 50)
|
||||
* @return array Data including the requested Contribution Scores.
|
||||
*/
|
||||
public static function getContributionScoreData( $days, $limit ) {
|
||||
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoreIgnoreUsernames,
|
||||
$wgContribScoreUseRoughEditCount;
|
||||
|
||||
$loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
|
||||
$dbr = $loadBalancer->getConnection( DB_REPLICA );
|
||||
|
||||
$revQuery = ActorMigration::newMigration()->getJoin( 'rev_user' );
|
||||
$revQuery['tables'] = array_merge( [ 'revision' ], $revQuery['tables'] );
|
||||
|
||||
$revUser = $revQuery['fields']['rev_user'];
|
||||
$revUsername = $revQuery['fields']['rev_user_text'];
|
||||
|
||||
$sqlWhere = [];
|
||||
|
||||
if ( $days > 0 ) {
|
||||
$date = time() - ( 60 * 60 * 24 * $days );
|
||||
$sqlWhere[] = 'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $date ) );
|
||||
}
|
||||
|
||||
$sqlVars = [
|
||||
'rev_user' => $revUser,
|
||||
'page_count' => 'COUNT(DISTINCT rev_page)'
|
||||
];
|
||||
if ( $wgContribScoreUseRoughEditCount ) {
|
||||
$revQuery['tables'][] = 'user';
|
||||
$revQuery['joins']['user'] = [ 'LEFT JOIN', [ "$revUser != 0", "user_id = $revUser" ] ];
|
||||
$sqlVars['rev_count'] = 'user_editcount';
|
||||
} else {
|
||||
$sqlVars['rev_count'] = 'COUNT(rev_id)';
|
||||
}
|
||||
|
||||
if ( $wgContribScoreIgnoreBlockedUsers ) {
|
||||
$sqlWhere[] = "{$revUser} NOT IN " .
|
||||
$dbr->buildSelectSubquery( [
|
||||
'block',
|
||||
'block_target'
|
||||
],
|
||||
'bt_user',
|
||||
'bt_user <> 0',
|
||||
__METHOD__,
|
||||
[],
|
||||
[
|
||||
'block_target' => [ 'JOIN', [
|
||||
'bl_target=bt_id'
|
||||
] ]
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if ( $wgContribScoreIgnoreBots ) {
|
||||
$sqlWhere[] = "{$revUser} NOT IN " .
|
||||
$dbr->buildSelectSubquery( 'user_groups', 'ug_user', [
|
||||
'ug_group' => 'bot',
|
||||
'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
|
||||
], __METHOD__ );
|
||||
}
|
||||
|
||||
if ( count( $wgContribScoreIgnoreUsernames ) ) {
|
||||
$listIgnoredUsernames = $dbr->makeList( $wgContribScoreIgnoreUsernames );
|
||||
$sqlWhere[] = "{$revUsername} NOT IN ($listIgnoredUsernames)";
|
||||
}
|
||||
|
||||
if ( $dbr->unionSupportsOrderAndLimit() ) {
|
||||
$order = [
|
||||
'GROUP BY' => 'rev_user',
|
||||
'ORDER BY' => 'page_count DESC',
|
||||
'LIMIT' => $limit
|
||||
];
|
||||
} else {
|
||||
$order = [ 'GROUP BY' => 'rev_user' ];
|
||||
}
|
||||
|
||||
$sqlMostPages = $dbr->selectSQLText(
|
||||
$revQuery['tables'],
|
||||
$sqlVars,
|
||||
$sqlWhere,
|
||||
__METHOD__,
|
||||
$order,
|
||||
$revQuery['joins']
|
||||
);
|
||||
|
||||
if ( $dbr->unionSupportsOrderAndLimit() ) {
|
||||
$order['ORDER BY'] = 'rev_count DESC';
|
||||
}
|
||||
|
||||
$sqlMostRevs = $dbr->selectSQLText(
|
||||
$revQuery['tables'],
|
||||
$sqlVars,
|
||||
$sqlWhere,
|
||||
__METHOD__,
|
||||
$order,
|
||||
$revQuery['joins']
|
||||
);
|
||||
|
||||
$sqlMostPagesOrRevs = $dbr->unionQueries( [ $sqlMostPages, $sqlMostRevs ], false );
|
||||
$res = $dbr->select(
|
||||
[
|
||||
'u' => 'user',
|
||||
's' => new Wikimedia\Rdbms\Subquery( $sqlMostPagesOrRevs ),
|
||||
],
|
||||
[
|
||||
'user_id',
|
||||
'user_name',
|
||||
'user_real_name',
|
||||
'page_count',
|
||||
'rev_count',
|
||||
'wiki_rank' => 'page_count+SQRT(rev_count-page_count)*2',
|
||||
],
|
||||
[],
|
||||
__METHOD__,
|
||||
[
|
||||
'ORDER BY' => 'wiki_rank DESC',
|
||||
'LIMIT' => $limit,
|
||||
],
|
||||
[
|
||||
's' => [
|
||||
'JOIN',
|
||||
'user_id=rev_user'
|
||||
]
|
||||
]
|
||||
);
|
||||
$ret = iterator_to_array( $res );
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/// Generates a "Contribution Scores" table for a given LIMIT and date range
|
||||
|
||||
/**
|
||||
* Function generates Contribution Scores tables in HTML format (not wikiText)
|
||||
*
|
||||
* @param int $days Days in the past to run report for
|
||||
* @param int $limit Maximum number of users to return (default 50)
|
||||
* @param string|null $title The title of the table
|
||||
* @param array $options array of options (default none; nosort/notools)
|
||||
* @return string Html Table representing the requested Contribution Scores.
|
||||
*/
|
||||
function genContributionScoreTable( $days, $limit, $title = null, $options = 'none' ) {
|
||||
global $wgContribScoresUseRealName, $wgContribScoreCacheTTL;
|
||||
|
||||
$opts = explode( ',', strtolower( $options ) );
|
||||
|
||||
$sortable = in_array( 'nosort', $opts ) ? '' : ' sortable';
|
||||
|
||||
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" .
|
||||
"<tr class='header'>\n" .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-rank' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-score' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-pages' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-changes' )->text() ) .
|
||||
Html::element( 'th', [], $this->msg( 'contributionscores-username' )->text() );
|
||||
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
$data = $cache->getWithSetCallback(
|
||||
$cache->makeKey( 'contributionscores', 'data-' . (string)$days ),
|
||||
$wgContribScoreCacheTTL * 60,
|
||||
function () use ( $days ) {
|
||||
// Use max limit, as limit doesn't matter with performance.
|
||||
// Avoid purge multiple times since limit on transclusion can be vary.
|
||||
return self::getContributionScoreData( $days, self::CONTRIBUTIONSCORES_MAXINCLUDELIMIT );
|
||||
} );
|
||||
|
||||
$lang = $this->getLanguage();
|
||||
|
||||
$altrow = '';
|
||||
$user_rank = 1;
|
||||
|
||||
foreach ( $data as $row ) {
|
||||
if ( $user_rank > $limit ) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Use real name if option used and real name present.
|
||||
if ( $wgContribScoresUseRealName && $row->user_real_name !== '' ) {
|
||||
$userLink = Linker::userLink(
|
||||
$row->user_id,
|
||||
$row->user_name,
|
||||
$row->user_real_name
|
||||
);
|
||||
} else {
|
||||
$userLink = Linker::userLink(
|
||||
$row->user_id,
|
||||
$row->user_name
|
||||
);
|
||||
}
|
||||
|
||||
$output .= Html::closeElement( 'tr' );
|
||||
$output .= "<tr class='{$altrow}'>\n" .
|
||||
"<td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( $user_rank ) .
|
||||
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( round( $row->wiki_rank, 0 ) ) .
|
||||
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( $row->page_count ) .
|
||||
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
|
||||
$lang->formatNum( $row->rev_count ) .
|
||||
"\n</td><td class='content'>" .
|
||||
$userLink;
|
||||
|
||||
# Option to not display user tools
|
||||
if ( !in_array( 'notools', $opts ) ) {
|
||||
$output .= Linker::userToolLinks( $row->user_id, $row->user_name );
|
||||
}
|
||||
|
||||
$output .= Html::closeElement( 'td' ) . "\n";
|
||||
|
||||
if ( $altrow == '' && empty( $sortable ) ) {
|
||||
$altrow = 'odd ';
|
||||
} else {
|
||||
$altrow = '';
|
||||
}
|
||||
|
||||
$user_rank++;
|
||||
}
|
||||
$output .= Html::closeElement( 'tr' );
|
||||
$output .= Html::closeElement( 'table' );
|
||||
|
||||
// Transcluded on a normal wiki page.
|
||||
if ( !empty( $title ) ) {
|
||||
$output = Html::rawElement( 'table',
|
||||
[
|
||||
'style' => 'border-spacing: 0; padding: 0',
|
||||
'class' => 'contributionscores-wrapper',
|
||||
'lang' => htmlspecialchars( $lang->getCode() ),
|
||||
'dir' => $lang->getDir()
|
||||
],
|
||||
"\n" .
|
||||
"<tr>\n" .
|
||||
"<td style='padding: 0px;'>{$title}</td>\n" .
|
||||
"</tr>\n" .
|
||||
"<tr>\n" .
|
||||
"<td style='padding: 0px;'>{$output}</td>\n" .
|
||||
"</tr>\n"
|
||||
);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function execute( $par ) {
|
||||
$this->setHeaders();
|
||||
|
||||
if ( $this->including() ) {
|
||||
$this->showInclude( $par );
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when being included on a normal wiki page.
|
||||
* Cache is disabled so it can depend on the user language.
|
||||
* @param string|null $par A subpage give to the special page
|
||||
*/
|
||||
function showInclude( $par ) {
|
||||
$days = null;
|
||||
$limit = null;
|
||||
$options = 'none';
|
||||
|
||||
if ( !empty( $par ) ) {
|
||||
$params = explode( '/', $par );
|
||||
|
||||
$limit = intval( $params[0] );
|
||||
|
||||
if ( isset( $params[1] ) ) {
|
||||
$days = intval( $params[1] );
|
||||
}
|
||||
|
||||
if ( isset( $params[2] ) ) {
|
||||
$options = $params[2];
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $limit ) || $limit < 1 || $limit > self::CONTRIBUTIONSCORES_MAXINCLUDELIMIT ) {
|
||||
$limit = 10;
|
||||
}
|
||||
if ( $days === null || $days < 0 ) {
|
||||
$days = 7;
|
||||
}
|
||||
|
||||
if ( $days > 0 ) {
|
||||
$reportTitle = $this->msg( 'contributionscores-days' )->numParams( $days )->text();
|
||||
} else {
|
||||
$reportTitle = $this->msg( 'contributionscores-allrevisions' )->text();
|
||||
}
|
||||
$reportTitle .= ' ' . $this->msg( 'contributionscores-top' )->numParams( $limit )->text();
|
||||
$title = Xml::element( 'h4',
|
||||
[ 'class' => 'contributionscores-title' ],
|
||||
$reportTitle
|
||||
) . "\n";
|
||||
$this->getOutput()->addHTML( $this->genContributionScoreTable(
|
||||
$days,
|
||||
$limit,
|
||||
$title,
|
||||
$options
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the special page
|
||||
*/
|
||||
function showPage() {
|
||||
global $wgContribScoreReports;
|
||||
|
||||
if ( !is_array( $wgContribScoreReports ) ) {
|
||||
$wgContribScoreReports = [
|
||||
[ 7, 50 ],
|
||||
[ 30, 50 ],
|
||||
[ 0, 50 ]
|
||||
];
|
||||
}
|
||||
|
||||
$out = $this->getOutput();
|
||||
$out->addWikiMsg( 'contributionscores-info' );
|
||||
|
||||
foreach ( $wgContribScoreReports as $scoreReport ) {
|
||||
[ $days, $revs ] = $scoreReport;
|
||||
if ( $days > 0 ) {
|
||||
$reportTitle = $this->msg( 'contributionscores-days' )->numParams( $days )->text();
|
||||
} else {
|
||||
$reportTitle = $this->msg( 'contributionscores-allrevisions' )->text();
|
||||
}
|
||||
$reportTitle .= ' ' . $this->msg( 'contributionscores-top' )->numParams( $revs )->text();
|
||||
$title = Xml::element( 'h2',
|
||||
[ 'class' => 'contributionscores-title' ],
|
||||
$reportTitle
|
||||
) . "\n";
|
||||
$out->addHTML( $title );
|
||||
$out->addHTML( $this->genContributionScoreTable( $days, $revs ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function maxIncludeCacheTime() {
|
||||
global $wgContribScoreDisableCache, $wgContribScoreCacheTTL;
|
||||
return $wgContribScoreDisableCache ? 0 : $wgContribScoreCacheTTL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function getGroupName() {
|
||||
return 'wiki';
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue