r40556 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40555‎ | r40556 | r40557 >
Date:23:35, 6 September 2008
Author:aaron
Status:old
Tags:
Comment:
Add edits-only filter to ListUsers (bug 10815)
Modified paths:
  • /trunk/phase3/includes/specials/SpecialListusers.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1299,6 +1299,7 @@
13001300 'protectedtitlesempty',
13011301 'listusers',
13021302 'listusers-summary',
 1303+ 'listusers-editsonly',
13031304 'newpages',
13041305 'newpages-summary',
13051306 'newpages-username',
Index: trunk/phase3/includes/specials/SpecialListusers.php
@@ -52,6 +52,7 @@
5353 if ( in_array( $this->requestedGroup, $symsForAll ) ) {
5454 $this->requestedGroup = '';
5555 }
 56+ $this->editsOnly = $wgRequest->getBool( 'editsOnly' );
5657
5758 $this->requestedUser = '';
5859 if ( $un != '' ) {
@@ -70,9 +71,9 @@
7172
7273 function getQueryInfo() {
7374 $dbr = wfGetDB( DB_SLAVE );
74 - $conds=array();
75 - // don't show hidden names
76 - $conds[]='ipb_deleted IS NULL OR ipb_deleted = 0';
 75+ $conds = array();
 76+ // Don't show hidden names
 77+ $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
7778 if ($this->requestedGroup != "") {
7879 $conds['ug_group'] = $this->requestedGroup;
7980 $useIndex = '';
@@ -82,6 +83,9 @@
8384 if ($this->requestedUser != "") {
8485 $conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser );
8586 }
 87+ if( $this->editsOnly ) {
 88+ $conds[] = 'user_editcount > 0';
 89+ }
8690
8791 list ($user,$user_groups,$ipblocks) = $dbr->tableNamesN('user','user_groups','ipblocks');
8892
@@ -121,13 +125,11 @@
122126 }
123127
124128 function getBody() {
125 - if (!$this->mQueryDone) {
 129+ if( !$this->mQueryDone ) {
126130 $this->doQuery();
127131 }
 132+ $this->mResult->rewind();
128133 $batch = new LinkBatch;
129 -
130 - $this->mResult->rewind();
131 -
132134 while ( $row = $this->mResult->fetchObject() ) {
133135 $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
134136 }
@@ -156,7 +158,9 @@
157159 Xml::option( wfMsg( 'group-all' ), '' );
158160 foreach( $this->getAllGroups() as $group => $groupText )
159161 $out .= Xml::option( $groupText, $group, $group == $this->requestedGroup );
160 - $out .= Xml::closeElement( 'select' ) . ' ';
 162+ $out .= Xml::closeElement( 'select' ) . '<br/>';
 163+ $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly );
 164+ $out .= '&nbsp;';
161165
162166 wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
163167
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2025,6 +2025,7 @@
20262026 'protectedtitlesempty' => 'No titles are currently protected with these parameters.',
20272027 'listusers' => 'User list',
20282028 'listusers-summary' => '', # do not translate or duplicate this message to other languages
 2029+'listusers-editsonly' => 'Show users with edits only',
20292030 'newpages' => 'New pages',
20302031 'newpages-summary' => '', # do not translate or duplicate this message to other languages
20312032 'newpages-username' => 'Username:',