Properly count actions in Special:ActiveUsers
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 1 Jul 2014 19:53:59 +0000 (15:53 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 1 Jul 2014 19:55:43 +0000 (15:55 -0400)
The cache of active users maintained by Special:ActiveUsers filters out
certain actions, but the displayed action count does not. Fix this.

Change-Id: Ifb9035a08328587c43c46520c5062602b9b9c6f5

includes/specials/SpecialActiveusers.php

index c42c089..8dc4b3c 100644 (file)
@@ -92,12 +92,16 @@ class ActiveUsersPager extends UsersPager {
        function getQueryInfo() {
                $dbr = $this->getDatabase();
 
+               $activeUserSeconds = $this->getConfig()->get( 'ActiveUserDays' ) * 86400;
+               $timestamp = $dbr->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds );
                $conds = array(
                        'qcc_type' => 'activeusers',
                        'qcc_namespace' => NS_USER,
                        'user_name = qcc_title',
                        'rc_user_text = qcc_title',
-                       'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ) // Don't count wikidata.
+                       'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ), // Don't count wikidata.
+                       'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' ),
+                       'rc_timestamp >= ' . $dbr->addQuotes( $timestamp ),
                );
                if ( $this->requestedUser != '' ) {
                        $conds[] = 'qcc_title >= ' . $dbr->addQuotes( $this->requestedUser );