Thread:Extension talk:Contribution Scores/Namespace Filtering/reply (3)

Here is what I did:

In ContributionScores_body.php, replace the following code (lines 61-77): $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}";

With the following code: $sqlWhere .= " {$nextPrefix} page_namespace IN (0, 4, 10, 12, 14)"; $nextPrefix = "AND";

$sqlMostPages = "SELECT rev_user,						 COUNT(DISTINCT rev_page) AS page_count,						 COUNT(rev_id) AS rev_count						 FROM {$revTable}						 JOIN page ON revision.rev_page = page.page_id						 {$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}						 JOIN page ON revision.rev_page = page.page_id						 {$sqlWhere}						 GROUP BY rev_user						 ORDER BY rev_count DESC						 LIMIT {$limit}";

A couple things to keep in mind with the code change above: 'contributionscores-info'           => "Scores are calculated as follows:  . 	Points are only scored for changes in the Main, TMHPWiki, Template, Help or Category namespaces.	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.",
 * It isn't a fully-baked solution. I just slammed in some extra SQL code.
 * The reference to the Page table is hard-coded.
 * The list of desired Namespaces is hard-coded.
 * The solution requires joining on the Page table affects performance. I haven't run any performance tests, but this might not be a good thing to do on a very large wiki.
 * I also updated ContributionScores.i18n.php to indicate that namespaces are used in the calculation. Actually I rewrote the entire description:

Hope this helps someone else. I am definitely more excited about using the extension now. Our wiki training takes place in the User namespace and having those edits included in the Score was just not working out.