UsersPager: Use CSS-based parentheses
[lhc/web/wiklou.git] / includes / specials / pagers / ActiveUsersPager.php
index aedb9e6..368c6d1 100644 (file)
@@ -138,15 +138,14 @@ class ActiveUsersPager extends UsersPager {
 
                // Outer query to select the recent edit counts for the selected active users
                $tables = [ 'qcc_users' => $subquery, 'recentchanges' ];
-               $jconds = [ 'recentchanges' => [
-                       'JOIN', $useActor ? 'rc_actor = actor_id' : 'rc_user_text = qcc_title',
-               ] ];
-               $conds = [
+               $jconds = [ 'recentchanges' => [ 'LEFT JOIN', [
+                       $useActor ? 'rc_actor = actor_id' : 'rc_user_text = qcc_title',
                        'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ), // Don't count wikidata.
                        'rc_type != ' . $dbr->addQuotes( RC_CATEGORIZE ), // Don't count categorization changes.
                        'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' ),
                        'rc_timestamp >= ' . $dbr->addQuotes( $timestamp ),
-               ];
+               ] ] ];
+               $conds = [];
 
                return [
                        'tables' => $tables,
@@ -154,7 +153,7 @@ class ActiveUsersPager extends UsersPager {
                                'qcc_title',
                                'user_name' => 'qcc_title',
                                'user_id' => 'user_id',
-                               'recentedits' => 'COUNT(*)'
+                               'recentedits' => 'COUNT(rc_id)'
                        ],
                        'options' => [ 'GROUP BY' => [ 'qcc_title' ] ],
                        'conds' => $conds,
@@ -162,14 +161,16 @@ class ActiveUsersPager extends UsersPager {
                ];
        }
 
-       protected function buildQueryInfo( $offset, $limit, $descending ) {
+       protected function buildQueryInfo( $offset, $limit, $order ) {
                $fname = __METHOD__ . ' (' . $this->getSqlComment() . ')';
 
                $sortColumns = array_merge( [ $this->mIndexField ], $this->mExtraSortFields );
-               if ( $descending ) {
+               if ( $order === self::QUERY_ASCENDING ) {
+                       $dir = 'ASC';
                        $orderBy = $sortColumns;
                        $operator = $this->mIncludeOffset ? '>=' : '>';
                } else {
+                       $dir = 'DESC';
                        $orderBy = [];
                        foreach ( $sortColumns as $col ) {
                                $orderBy[] = $col . ' DESC';
@@ -178,7 +179,7 @@ class ActiveUsersPager extends UsersPager {
                }
                $info = $this->getQueryInfo( [
                        'limit' => intval( $limit ),
-                       'order' => $descending ? 'DESC' : 'ASC',
+                       'order' => $dir,
                        'conds' =>
                                $offset != '' ? [ $this->mIndexField . $operator . $this->mDb->addQuotes( $offset ) ] : [],
                ] );
@@ -224,12 +225,22 @@ class ActiveUsersPager extends UsersPager {
                $userName = $row->user_name;
 
                $ulinks = Linker::userLink( $row->user_id, $userName );
-               $ulinks .= Linker::userToolLinks( $row->user_id, $userName );
+               $ulinks .= Linker::userToolLinks(
+                       $row->user_id,
+                       $userName,
+                       // Should the contributions link be red if the user has no edits (using default)
+                       false,
+                       // Customisation flags (using default 0)
+                       0,
+                       // User edit count (using default)
+                       null,
+                       // do not wrap the message in parentheses (CSS will provide these)
+                       false
+               );
 
                $lang = $this->getLanguage();
 
                $list = [];
-               $user = User::newFromId( $row->user_id );
 
                $ugms = self::getGroupMemberships( intval( $row->user_id ), $this->userGroupCache );
                foreach ( $ugms as $ugm ) {