Page Menu
Home
Miraheze
Search
Configure Global Search
Log In
Paste
P150
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Paladox
on Dec 4 2018, 22:21.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F871761:
Dec 4 2018, 22:40
2018-12-04 22:40:43 (UTC+0)
F871759:
Dec 4 2018, 22:38
2018-12-04 22:38:41 (UTC+0)
F871758:
Dec 4 2018, 22:28
2018-12-04 22:28:19 (UTC+0)
F871756:
Dec 4 2018, 22:21
2018-12-04 22:21:07 (UTC+0)
Subscribers
None
/**
* 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 = [];
if ( $days > 0 ) {
$date = time() - ( 60 * 60 * 24 * $days );
$dateString = $dbr->timestamp( $date );
$sqlWhere[] = "rev_timestamp > '$dateString'";
}
if ( $wgContribScoreIgnoreBlockedUsers ) {
$sqlWhere[] = "rev_user NOT IN " .
"(SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
}
if ( $wgContribScoreIgnoreBots ) {
$sqlWhere[] = "rev_user NOT IN " .
"(SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
}
$revQuery = Revision::getQueryInfo();
$sqlMostPages = $dbr->select(
$revQuery['tables'],
[
'rev_user' => $revQuery['fields']['rev_user'],
'page_count' => 'COUNT(DISTINCT rev_page)',
'rev_count' => 'COUNT(rev_id)',
],
$sqlWhere,
__METHOD__,
[
'GROUP BY' => 'rev_user',
'ORDER BY' => 'page_count DESC',
'LIMIT' => {$limit}
],
$revQuery['joins']
);
Event Timeline
Paladox
created this paste.
Dec 4 2018, 22:21
2018-12-04 22:21:07 (UTC+0)
Paladox
edited the content of this paste.
(Show Details)
Dec 4 2018, 22:28
2018-12-04 22:28:19 (UTC+0)
Paladox
edited the content of this paste.
(Show Details)
Dec 4 2018, 22:38
2018-12-04 22:38:41 (UTC+0)
Paladox
edited the content of this paste.
(Show Details)
Dec 4 2018, 22:40
2018-12-04 22:40:43 (UTC+0)
Log In to Comment