Revision: 46177
Author: aaron
Date: 2009-01-25 01:22:58 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
(bug 3301) Optionally sort user list according to account creation time
Modified Paths:
--------------
trunk/phase3/includes/specials/SpecialListusers.php
trunk/phase3/languages/messages/MessagesEn.php
trunk/phase3/maintenance/language/messages.inc
Modified: trunk/phase3/includes/specials/SpecialListusers.php
===================================================================
--- trunk/phase3/includes/specials/SpecialListusers.php 2009-01-25 00:48:30 UTC
(rev 46176)
+++ trunk/phase3/includes/specials/SpecialListusers.php 2009-01-25 01:22:58 UTC
(rev 46177)
@@ -53,6 +53,7 @@
$this->requestedGroup = '';
}
$this->editsOnly = $wgRequest->getBool( 'editsOnly' );
+ $this->creationSort = $wgRequest->getBool( 'creationSort' );
$this->requestedUser = '';
if ( $un != '' ) {
@@ -66,7 +67,7 @@
function getIndexField() {
- return 'user_name';
+ return $this->creationSort ? 'user_id' : 'user_name';
}
function getQueryInfo() {
@@ -74,14 +75,19 @@
$conds = array();
// Don't show hidden names
$conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
- if ($this->requestedGroup != "") {
+ if( $this->requestedGroup != '' ) {
$conds['ug_group'] = $this->requestedGroup;
$useIndex = '';
} else {
- $useIndex = $dbr->useIndexClause('user_name');
+ $useIndex = $dbr->useIndexClause( $this->creationSort ?
'PRIMARY' : 'user_name');
}
- if ($this->requestedUser != "") {
- $conds[] = 'user_name >= ' . $dbr->addQuotes(
$this->requestedUser );
+ if( $this->requestedUser != '' ) {
+ # Sorted either by account creation or name
+ if( $this->creationSort ) {
+ $conds[] = 'user_id >= ' . User::idFromName(
$this->requestedUser );
+ } else {
+ $conds[] = 'user_name >= ' . $dbr->addQuotes(
$this->requestedUser );
+ }
}
if( $this->editsOnly ) {
$conds[] = 'user_editcount > 0';
@@ -96,7 +102,8 @@
'MAX(user_id) AS user_id',
'MAX(user_editcount) AS edits',
'COUNT(ug_group) AS numgroups',
- 'MAX(ug_group) AS singlegroup'),
+ 'MAX(ug_group) AS singlegroup',
+ 'MIN(user_registration) AS creation'),
'options' => array('GROUP BY' => 'user_name'),
'conds' => $conds
);
@@ -131,8 +138,16 @@
} else {
$edits = '';
}
+
+ $created = '';
+ # Some rows may be NULL
+ if( $row->creation ) {
+ $d = $wgLang->timeanddate( wfTimestamp( TS_MW,
$row->creation ), true );
+ $created = ' (' . wfMsgHtml( 'usercreated', $d ) . ')';
+ }
+
wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row )
);
- return "<li>{$item}{$edits}</li>";
+ return "<li>{$item}{$edits}{$created}</li>";
}
function getBody() {
@@ -172,12 +187,13 @@
$out .= Xml::closeElement( 'select' ) . '<br/>';
$out .= Xml::checkLabel( wfMsg('listusers-editsonly'),
'editsOnly', 'editsOnly', $this->editsOnly );
$out .= ' ';
+ $out .= Xml::checkLabel( wfMsg('listusers-creationsort'),
'creationSort', 'creationSort', $this->creationSort );
+ $out .= '<br/>';
wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out )
);
# Submit button and form bottom
- if( $this->mLimit )
- $out .= Xml::hidden( 'limit', $this->mLimit );
+ $out .= Xml::hidden( 'limit', $this->mLimit );
$out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) );
$out .= '</fieldset>' .
Modified: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php 2009-01-25 00:48:30 UTC
(rev 46176)
+++ trunk/phase3/languages/messages/MessagesEn.php 2009-01-25 01:22:58 UTC
(rev 46177)
@@ -2130,7 +2130,9 @@
'protectedtitlesempty' => 'No titles are currently protected with
these parameters.',
'listusers' => 'User list',
'listusers-summary' => '', # do not translate or duplicate this
message to other languages
-'listusers-editsonly' => 'Show users with edits only',
+'listusers-editsonly' => 'Show only users with edits',
+'listusers-creationsort' => 'Sort by creation date',
+'usercreated' => 'Created on $1',
'usereditcount' => '$1 {{PLURAL:$1|edit|edits}}',
'newpages' => 'New pages',
'newpages-summary' => '', # do not translate or duplicate this
message to other languages
Modified: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc 2009-01-25 00:48:30 UTC
(rev 46176)
+++ trunk/phase3/maintenance/language/messages.inc 2009-01-25 01:22:58 UTC
(rev 46177)
@@ -1411,7 +1411,9 @@
'listusers',
'listusers-summary',
'listusers-editsonly',
+ 'listusers-creationsort',
'usereditcount',
+ 'usercreated',
'newpages',
'newpages-summary',
'newpages-username',
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs