From 1af93cfac5f203d05915d88df3a39aa4d7be735d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 6 Sep 2008 23:35:24 +0000 Subject: [PATCH] Add edits-only filter to ListUsers (bug 10815) --- includes/specials/SpecialListusers.php | 20 ++++++++++++-------- languages/messages/MessagesEn.php | 1 + maintenance/language/messages.inc | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 4a76c0c223..7b65adb269 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -52,6 +52,7 @@ class UsersPager extends AlphabeticPager { if ( in_array( $this->requestedGroup, $symsForAll ) ) { $this->requestedGroup = ''; } + $this->editsOnly = $wgRequest->getBool( 'editsOnly' ); $this->requestedUser = ''; if ( $un != '' ) { @@ -70,9 +71,9 @@ class UsersPager extends AlphabeticPager { function getQueryInfo() { $dbr = wfGetDB( DB_SLAVE ); - $conds=array(); - // don't show hidden names - $conds[]='ipb_deleted IS NULL OR ipb_deleted = 0'; + $conds = array(); + // Don't show hidden names + $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0'; if ($this->requestedGroup != "") { $conds['ug_group'] = $this->requestedGroup; $useIndex = ''; @@ -82,6 +83,9 @@ class UsersPager extends AlphabeticPager { if ($this->requestedUser != "") { $conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser ); } + if( $this->editsOnly ) { + $conds[] = 'user_editcount > 0'; + } list ($user,$user_groups,$ipblocks) = $dbr->tableNamesN('user','user_groups','ipblocks'); @@ -121,13 +125,11 @@ class UsersPager extends AlphabeticPager { } function getBody() { - if (!$this->mQueryDone) { + if( !$this->mQueryDone ) { $this->doQuery(); } - $batch = new LinkBatch; - $this->mResult->rewind(); - + $batch = new LinkBatch; while ( $row = $this->mResult->fetchObject() ) { $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) ); } @@ -156,7 +158,9 @@ class UsersPager extends AlphabeticPager { Xml::option( wfMsg( 'group-all' ), '' ); foreach( $this->getAllGroups() as $group => $groupText ) $out .= Xml::option( $groupText, $group, $group == $this->requestedGroup ); - $out .= Xml::closeElement( 'select' ) . ' '; + $out .= Xml::closeElement( 'select' ) . '
'; + $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly ); + $out .= ' '; wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 11f74de50e..f24fded51d 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2025,6 +2025,7 @@ Each row contains links to the first and second redirect, as well as the target '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', 'newpages' => 'New pages', 'newpages-summary' => '', # do not translate or duplicate this message to other languages 'newpages-username' => 'Username:', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index d9f4bac2d0..8da58a443d 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1299,6 +1299,7 @@ $wgMessageStructure = array( 'protectedtitlesempty', 'listusers', 'listusers-summary', + 'listusers-editsonly', 'newpages', 'newpages-summary', 'newpages-username', -- 2.20.1