Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions specials/SpecialPageStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,33 @@ public function renderPageStats() {
// Load the styles for the D3.js force directed graph
// $wgOut->addModuleStyles( 'ext.watchanalytics.forcegraph.styles' );


// Per https://www.mediawiki.org/wiki/Manual:Revision_table#rev_actor the
// table schema and which tables contain this data may change after MW1.35
//
// SELECT
// rev.rev_user,
// rev.rev_user_text,
// rev.revactor_actor,
// act.actor_name,
// COUNT( * ) AS num_revisions
// FROM revision AS rev
// LEFT JOIN page AS p ON p.page_id = rev.rev_page
// WHERE p.page_title = "US_EVA_29_(US_EVA_IDA1_Cables)" AND p.page_namespace = 0
// GROUP BY rev.rev_user
// FROM revision_actor_temp AS rev
// LEFT JOIN page AS p ON p.page_id = rev.revactor_page
// LEFT JOIN actor AS act on act.actor_id = rev.revactor_actor
// WHERE p.page_title = "Main_Page" AND p.page_namespace = 0
// GROUP BY rev.revactor_actor
// ORDER BY num_revisions DESC

#
# Page editors query
#
$res = $dbr->select(
[
'rev' => 'revision',
'rev' => 'revision_actor_temp',
'p' => 'page',
'act' => 'actor',
],
[
'rev.rev_user',
'rev.rev_user_text',
'rev.revactor_actor',
'act.actor_name',
'COUNT( * ) AS num_revisions',
],
[
Expand All @@ -137,12 +143,15 @@ public function renderPageStats() {
],
__METHOD__,
[
'GROUP BY' => 'rev.rev_user',
'GROUP BY' => 'rev.revactor_actor',
'ORDER BY' => 'num_revisions DESC',
],
[
'p' => [
'LEFT JOIN', 'p.page_id = rev.rev_page'
'LEFT JOIN', 'p.page_id = rev.revactor_page'
],
'act' => [
'LEFT JOIN', 'act.actor_id = rev.revactor_actor'
],
]
);
Expand All @@ -160,7 +169,7 @@ public function renderPageStats() {
Xml::openElement( 'li' )
. wfMessage(
'watchanalytics-pagestats-editors-list-item',
Linker::userLink( $row->rev_user, $row->rev_user_text ),
Linker::userLink( $row->revactor_actor, $row->actor_name ),
$row->num_revisions
)->text()
. Xml::closeElement( 'li' );
Expand Down