Extension talk:Contribution Scores
Contents
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |
Hi,
This extension is failing to work in 1.16.
It's failing on a call to getOutput() that seems to have been added in the 1.18 release of mediawiki.
Is there an older SVN revision you can point me to that will work with 1.16?
The REL1_16 branch didn't go anywhere. :)
You should really upgrade, though. Since 1.17 you don't even need command line and it's a single step to 1.20. ;-)
This is a nice extension that has motivated my users to contribute. Unfortunately the scores are bloated by image uploads which each count as a page. Could you please add an option to limit or include only certain namespaces, for example Main only, or excluding File namespace. I think this would be an easy addition to the SQL as the field is in the page table.
With enabled $wgShowSQLErrors in LocalSettings.php:
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
SELECT user_id, user_name, page_count, rev_count, page_count+SQRT(rev_count-page_count)*2 AS wiki_rank FROM user u JOIN ((SELECT rev_user, COUNT(DISTINCT rev_page) AS page_count, COUNT(rev_id) AS rev_count FROM revision WHERE rev_timestamp > '20120925235315' AND rev_user NOT IN (SELECT ipb_user FROM ipblocks WHERE ipb_user <> 0) AND rev_user NOT IN (SELECT ug_user FROM user_groups WHERE ug_group='bot') GROUP BY rev_user ORDER BY page_count DESC LIMIT 50) UNION (SELECT rev_user, COUNT(DISTINCT rev_page) AS page_count, COUNT(rev_id) AS rev_count FROM revision WHERE rev_timestamp > '20120925235315' AND rev_user NOT IN (SELECT ipb_user FROM ipblocks WHERE ipb_user <> 0) AND rev_user NOT IN (SELECT ug_user FROM user_groups WHERE ug_group='bot') GROUP BY rev_user ORDER BY rev_count DESC LIMIT 50)) s ON (user_id=rev_user) ORDER BY wiki_rank DESC LIMIT 50
from within function "". Database returned error "1: near "UNION": syntax error".
Hi I am using this extension and I get garbled titles (image below), and the special page listing in "version" doesn't say "Contribution Scores" it says '< contributionscores > (characters are omitted so it displays in this post)
Here is a picture http://img820.imageshack.us/img820/6186/screenshot20120701at934.png
MW 1.19.1
Thank you 24.130.249.87
Having a similar issue MW 1.18.0, but not 1.18.2...
That usually means that you're lacking the corresponding System messages.
I noticed that UserNames aren't appearing in 1.17.5 for me. I added an image http://img444.imageshack.us/img444/5271/screenshot20120701at818.png
Thank you 207.47.18.254 19:52, 2 July 2012 (UTC)
* {{PLURAL:{{#cscore:SomeUser|changes}}|change|changes}} (should return "change" if user has 1 edit)
* {{#ifeq:{{#cscore:SomeUser|changes}}|1|change|changes}} (should return "change" if user has 1 edit)
* {{#ifexpr: {{#cscore:SomeUser|changes}} > 2 | 2+ | 0 or 1 }}
The output of #cscore cannot be used for further parsing.
To add further parsing you should modify the last line of the file ContributionScores.php
return $parser->insertStripItem($output, $parser->mStripState);
TO
return $output;
Naturally it is not a secure or good solution if you want to use this extension, but if your purpose is to use the additional parsing then it is enough.
Is there anyway to reset the contribution scores?
Just as the title says. Please re-transate and fix. Schmelzle 21:39, 23 January 2012 (UTC)
Correct formula explanation would read: "Bewertung = (Anzahl der bearbeiteten Seiten) + 2 * Quadratwurzel aus ((Anzahl der Bearbeitungen) - (Anzahl der bearbeiteten Seiten))". Hope this helps.
Would help if you post the title of the message.
It is the translation for 'contributionscores-info'. I changed this in my installation to a proper translated explanation:
'contributionscores-info' => 'Für diese Statistik wird folgendes Bewertungsschema angewandt:
Bewertung = (Anzahl der bearbeiteten Seiten) + 2 * Quadratwurzel aus ((Anzahl der Bearbeitungen) - (Anzahl der bearbeiteten Seiten))
Die Bewertungen auf dieser Grundlage gewichten die Vielfalt der Mitarbeit höher als das reine Beitragsvolumen.',
I don't think the score definition is fair. E.g. I have 54470 changes on 33365 pages - score: 33656. Is it possible to use a plain average instead?
Another odd one: 5 changes on 3 pages = score 6 huh?
There appears to be no errors, however the extension never updates after edits.
Cache? Turn on erorr reports, see Manual:How to debug
Hi! I would like to use this extension on our company wiki because it seems great, but unfortunately our usernames must corespond to our user-ID so our toplist would look something like...
-
- AA1984
- AB8373
- BA8308
- etc...
This would make it impossible to know who has contributed and I believe the point with the extension would be lost. =/
Is there a possibility to use the column "real name" or "e-mail" instead of username? Thanks!
In Special:Code/MediaWiki/108127, Special:Code/MediaWiki/108128, Special:Code/MediaWiki/108129 I made changes to make this possible. It requires the latest versions of the extension and MediaWiki 1.19 alpha or later.
The extension should return formatted numbers, i.e. 12,365 instead of 12365. It's an easy fix:
- replace
$row->page_countwithnumber_format($row->page_count)(4 times for "pages" and "changes") - replace
round($row->wiki_rank,0)withnumber_format(round($row->wiki_rank,0))(2 times for "score")
in ContributionScores.php and ContributionScores_body.php
The cells inside the tr tag should be th's, not td's:
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n".
"<tr class='header'>\n".
"<th>" . wfMsgHtml( 'contributionscores-score' ) . "</th>\n" .
"<th>" . wfMsgHtml( 'contributionscores-pages' ) . "</th>\n" .
"<th>" . wfMsgHtml( 'contributionscores-changes' ) . "</th>\n" .
"<th>" . wfMsgHtml( 'contributionscores-username' ) . "</th>\n";
They are, aren't they?
I did some minor refactoring in Special:Code/MediaWiki/108121.
Is it possible to exclude persons/groups etc from the list? I read on mixed db's wiki that the bots have been excluded but how?
You forgot $wgLang->formatNum();.
Where exactly? Looks to me like all the numbers are correctly localised: https://translatewiki.net/wiki/Special:ContributionScores?uselang=hi
Would it be possible to display scores of certain groups only (say Administrators)? My wiki currently has many different groups and it would be great to be able to display the top scores of each group.
When using the extension with the SQLite database backend i get an SQL error.
„1: near "UNION": syntax error“.
Maybe SQLite is not aware of union statements?
Had a little programming fun and implemented the new metric Page Creations (for MW 1.13). Only new pages created with a minimum of 256Bytes will count, in order to avoid having Users try to boost their score by creating lots of empty pages. As well file uploads are logged as 0 length new page creations. I'd rather not have those count either.
Note: I use a different formula than the one that was precoded. I'm not much of a sql wizard. And never used php before. So be weary of this code ;-)
ContributionScores.php: these changes will add a new metric {{#cscore:Rst|pagecreations}} and change how the score metric is calculated.
if ($metric=='score') {
$res = $dbr->select('revision',
'COUNT(DISTINCT rev_page)+(COUNT(rev_id)-COUNT(DISTINCT rev_page))/2 AS wiki_rank',
array('rev_user' => $user->getID()));
$row = $dbr->fetchObject($res);
$wiki_rank = $row->wiki_rank;
$userid = $user->getID();
$res = $dbr->query("SELECT COUNT(rev_id) AS pagecreation_count FROM revision WHERE rev_parent_id=0 AND rev_len>256 AND rev_user={$userid}");
$row = $dbr->fetchObject($res);
$wiki_rank = $wiki_rank + $row->pagecreation_count/2;
$output = round($wiki_rank,0);
} elseif ($metric=='pagecreations') {
$userid = $user->getID();
$res = $dbr->query("SELECT COUNT(rev_id) AS pagecreation_count FROM revision WHERE rev_parent_id=0 AND rev_len>256 AND rev_user={$userid}");
$row = $dbr->fetchObject($res);
$output = $row->pagecreation_count;
}
ContributionScores_body.php: these changes will add new column Pages Created to the Lists:
$sqlMostNewPages = "SELECT rev_user,
COUNT(DISTINCT rev_page) AS newpage_count
FROM {$revTable}
{$sqlWhere} AND rev_parent_id=0 AND rev_len > 256
GROUP BY rev_user
ORDER BY newpage_count DESC
LIMIT {$limit}";
$sqltmp = "SELECT user_id, " .
"user_name, " .
"page_count, " .
"rev_count " .
"FROM $userTable u JOIN (($sqlMostPages) UNION ($sqlMostRevs)) s ON (user_id=rev_user) " .
"LIMIT $limit";
$sql = "SELECT res1.user_id, " .
"res1.user_name, " .
"res1.page_count, " .
"res2.newpage_count, " .
"res1.rev_count, " .
"res1.page_count+(res1.rev_count-res1.page_count)/2 + res2.newpage_count/2 AS wiki_rank " .
"FROM ( ($sqltmp) as res1, ($sqlMostNewPages) as res2 ) " .
"WHERE res1.user_id=res2.rev_user ORDER BY wiki_rank DESC " .
"LIMIT $limit";
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n".
"<tr class='header'>\n".
"<td>" . wfMsgHtml( 'contributionscores-score' ) . "</td>\n" .
"<td>" . wfMsgHtml( 'contributionscores-pages' ) . "</td>\n" .
"<td>" . wfMsgHtml( 'contributionscores-changes' ) . "</td>\n" .
"<td>" . wfMsgHtml( 'contributionscores-newpages' ) . "</td>\n" .
"<td>" . wfMsgHtml( 'contributionscores-username' ) . "</td>\n";
$output .= "</tr><tr class='{$altrow}'>\n<td class='content'>" .
round($row->wiki_rank,0) . "\n</td><td class='content'>" .
$row->page_count . "\n</td><td class='content'>" .
$row->rev_count . "\n</td><td class='content'>" .
$row->newpage_count . "\n</td><td class='content'>" .
$skin->userLink( $row->user_id, $row->user_name );
ContributionScores.i18n.php: only showing en changes:
$messages['en'] = array(
'contributionscores' => 'Contribution scores',
'contributionscores-desc' => 'Polls the wiki database for highest [[Special:ContributionScores|user contribution volume]]',
'contributionscores-info' => "Scores are calculated as follows:
*One (1) point for each unique page edited
*(total edits made - total unique pages) / 2
*Half a point for each newly created Page with content
Scores calculated in this manner weight edit diversity over edit volume.
Basically, this score measures primarily unique pages edited, with consideration for high edit volume - assumed to be a higher quality page.",
'contributionscores-top' => '(Top $1)',
'contributionscores-days' => 'Last $1 days',
'contributionscores-allrevisions' => 'All revisions',
'contributionscores-score' => 'Score',
'contributionscores-pages' => 'Pages',
'contributionscores-changes' => 'Changes',
'contributionscores-newpages' => 'Page creations',
'contributionscores-username' => 'Username',
'contributionscores-invalidusername' => 'Invalid username',
'contributionscores-invalidmetric' => 'Invalid metric',
);
Really like it a lot. Had a quick look at the mysql database and came up with two potentially useful/interesting additions that could be made rather easily:
- Number of new Pages created (while in populating your wiki stage could be boosted in the score calculation)
select count(*) from revision where user_id=x and rev_parent_id=0;
- Total number of characters added (pseudo_code)
Sum_all-revisions-of-user-X( (rev_len(current revision) - rev_len(parent revision) )
In addition I'd think it would be neat if the formula for the Contribution Score could include those values and be changed in either LocalSettings.php or via a Special:ContributionScoreFormula page. Scores really get people hooked and changing the formula helps steer users in the direction you want the wiki to take.
Thanks for the great extension. Would it be possible to alter the extension to show a table of:
User Pages edited Date of last edit
---- ------------ -----------------
Jonathan dfjsdflskjf 1/2/08
sdkfljsfljsdfslkj 1/5/09
sdflkjdflsfj 1/1/09
Andrew sdsdflkjsdfljk 5/4/02
sdflkjsflksjf 5/5/09
(etc)
My wiki is quite small so I wouldn't be worried if it involved a lot of SQL queries!
Also, would it be possible to ignore a particular editor (me) who has done nearly all the pages?
Many thanks
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |



