Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1411,7 +1411,9 @@ |
1412 | 1412 | 'listusers', |
1413 | 1413 | 'listusers-summary', |
1414 | 1414 | 'listusers-editsonly', |
| 1415 | + 'listusers-creationsort', |
1415 | 1416 | 'usereditcount', |
| 1417 | + 'usercreated', |
1416 | 1418 | 'newpages', |
1417 | 1419 | 'newpages-summary', |
1418 | 1420 | 'newpages-username', |
Index: trunk/phase3/includes/specials/SpecialListusers.php |
— | — | @@ -53,6 +53,7 @@ |
54 | 54 | $this->requestedGroup = ''; |
55 | 55 | } |
56 | 56 | $this->editsOnly = $wgRequest->getBool( 'editsOnly' ); |
| 57 | + $this->creationSort = $wgRequest->getBool( 'creationSort' ); |
57 | 58 | |
58 | 59 | $this->requestedUser = ''; |
59 | 60 | if ( $un != '' ) { |
— | — | @@ -66,7 +67,7 @@ |
67 | 68 | |
68 | 69 | |
69 | 70 | function getIndexField() { |
70 | | - return 'user_name'; |
| 71 | + return $this->creationSort ? 'user_id' : 'user_name'; |
71 | 72 | } |
72 | 73 | |
73 | 74 | function getQueryInfo() { |
— | — | @@ -74,14 +75,19 @@ |
75 | 76 | $conds = array(); |
76 | 77 | // Don't show hidden names |
77 | 78 | $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0'; |
78 | | - if ($this->requestedGroup != "") { |
| 79 | + if( $this->requestedGroup != '' ) { |
79 | 80 | $conds['ug_group'] = $this->requestedGroup; |
80 | 81 | $useIndex = ''; |
81 | 82 | } else { |
82 | | - $useIndex = $dbr->useIndexClause('user_name'); |
| 83 | + $useIndex = $dbr->useIndexClause( $this->creationSort ? 'PRIMARY' : 'user_name'); |
83 | 84 | } |
84 | | - if ($this->requestedUser != "") { |
85 | | - $conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser ); |
| 85 | + if( $this->requestedUser != '' ) { |
| 86 | + # Sorted either by account creation or name |
| 87 | + if( $this->creationSort ) { |
| 88 | + $conds[] = 'user_id >= ' . User::idFromName( $this->requestedUser ); |
| 89 | + } else { |
| 90 | + $conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser ); |
| 91 | + } |
86 | 92 | } |
87 | 93 | if( $this->editsOnly ) { |
88 | 94 | $conds[] = 'user_editcount > 0'; |
— | — | @@ -96,7 +102,8 @@ |
97 | 103 | 'MAX(user_id) AS user_id', |
98 | 104 | 'MAX(user_editcount) AS edits', |
99 | 105 | 'COUNT(ug_group) AS numgroups', |
100 | | - 'MAX(ug_group) AS singlegroup'), |
| 106 | + 'MAX(ug_group) AS singlegroup', |
| 107 | + 'MIN(user_registration) AS creation'), |
101 | 108 | 'options' => array('GROUP BY' => 'user_name'), |
102 | 109 | 'conds' => $conds |
103 | 110 | ); |
— | — | @@ -131,8 +138,16 @@ |
132 | 139 | } else { |
133 | 140 | $edits = ''; |
134 | 141 | } |
| 142 | + |
| 143 | + $created = ''; |
| 144 | + # Some rows may be NULL |
| 145 | + if( $row->creation ) { |
| 146 | + $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->creation ), true ); |
| 147 | + $created = ' (' . wfMsgHtml( 'usercreated', $d ) . ')'; |
| 148 | + } |
| 149 | + |
135 | 150 | wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); |
136 | | - return "<li>{$item}{$edits}</li>"; |
| 151 | + return "<li>{$item}{$edits}{$created}</li>"; |
137 | 152 | } |
138 | 153 | |
139 | 154 | function getBody() { |
— | — | @@ -172,12 +187,13 @@ |
173 | 188 | $out .= Xml::closeElement( 'select' ) . '<br/>'; |
174 | 189 | $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly ); |
175 | 190 | $out .= ' '; |
| 191 | + $out .= Xml::checkLabel( wfMsg('listusers-creationsort'), 'creationSort', 'creationSort', $this->creationSort ); |
| 192 | + $out .= '<br/>'; |
176 | 193 | |
177 | 194 | wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) ); |
178 | 195 | |
179 | 196 | # Submit button and form bottom |
180 | | - if( $this->mLimit ) |
181 | | - $out .= Xml::hidden( 'limit', $this->mLimit ); |
| 197 | + $out .= Xml::hidden( 'limit', $this->mLimit ); |
182 | 198 | $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ); |
183 | 199 | wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) ); |
184 | 200 | $out .= '</fieldset>' . |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2130,7 +2130,9 @@ |
2131 | 2131 | 'protectedtitlesempty' => 'No titles are currently protected with these parameters.', |
2132 | 2132 | 'listusers' => 'User list', |
2133 | 2133 | 'listusers-summary' => '', # do not translate or duplicate this message to other languages |
2134 | | -'listusers-editsonly' => 'Show users with edits only', |
| 2134 | +'listusers-editsonly' => 'Show only users with edits', |
| 2135 | +'listusers-creationsort' => 'Sort by creation date', |
| 2136 | +'usercreated' => 'Created on $1', |
2135 | 2137 | 'usereditcount' => '$1 {{PLURAL:$1|edit|edits}}', |
2136 | 2138 | 'newpages' => 'New pages', |
2137 | 2139 | 'newpages-summary' => '', # do not translate or duplicate this message to other languages |