Merge "Minor cleanups on ContributionScores extension"

This commit is contained in:
jenkins-bot 2021-06-22 07:48:23 +00:00 committed by Gerrit Code Review
commit 5ade4bf529

View file

@ -106,8 +106,7 @@ class ContributionScores extends IncludableSpecialPage {
if ( $days > 0 ) { if ( $days > 0 ) {
$date = time() - ( 60 * 60 * 24 * $days ); $date = time() - ( 60 * 60 * 24 * $days );
$dateString = $dbr->timestamp( $date ); $sqlWhere[] = 'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $date ) );
$sqlWhere[] = "rev_timestamp > '$dateString'";
} }
if ( $wgContribScoreIgnoreBlockedUsers ) { if ( $wgContribScoreIgnoreBlockedUsers ) {
@ -125,12 +124,12 @@ class ContributionScores extends IncludableSpecialPage {
if ( $dbr->unionSupportsOrderAndLimit() ) { if ( $dbr->unionSupportsOrderAndLimit() ) {
$order = [ $order = [
'GROUP BY' => $revUser, 'GROUP BY' => 'rev_user',
'ORDER BY' => 'page_count DESC', 'ORDER BY' => 'page_count DESC',
'LIMIT' => $limit 'LIMIT' => $limit
]; ];
} else { } else {
$order = [ 'GROUP BY' => $revUser ]; $order = [ 'GROUP BY' => 'rev_user' ];
} }
$sqlMostPages = $dbr->selectSQLText( $sqlMostPages = $dbr->selectSQLText(
@ -147,13 +146,7 @@ class ContributionScores extends IncludableSpecialPage {
); );
if ( $dbr->unionSupportsOrderAndLimit() ) { if ( $dbr->unionSupportsOrderAndLimit() ) {
$order = [ $order['ORDER BY'] = 'rev_count DESC';
'GROUP BY' => 'rev_user',
'ORDER BY' => 'rev_count DESC',
'LIMIT' => $limit
];
} else {
$order = [ 'GROUP BY' => 'rev_user' ];
} }
$sqlMostRevs = $dbr->selectSQLText( $sqlMostRevs = $dbr->selectSQLText(
@ -230,7 +223,7 @@ class ContributionScores extends IncludableSpecialPage {
$output .= Html::closeElement( 'tr' ); $output .= Html::closeElement( 'tr' );
$output .= "<tr class='{$altrow}'>\n" . $output .= "<tr class='{$altrow}'>\n" .
"<td class='content' style='padding-right:10px;text-align:right;'>" . "<td class='content' style='padding-right:10px;text-align:right;'>" .
$lang->formatNum( round( $user_rank, 0 ) ) . $lang->formatNum( $user_rank ) .
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" . "\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .
$lang->formatNum( round( $row->wiki_rank, 0 ) ) . $lang->formatNum( round( $row->wiki_rank, 0 ) ) .
"\n</td><td class='content' style='padding-right:10px;text-align:right;'>" . "\n</td><td class='content' style='padding-right:10px;text-align:right;'>" .