From cfe197d6706cb3be258b72c596b8de270cec26db Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 1 May 2008 21:45:03 +0000 Subject: [PATCH] revert r34094 for now -- requires index that hasn't been deployed yet --- includes/DefaultSettings.php | 1 - includes/SpecialActiveusers.php | 209 ------------------------------ includes/SpecialListusers.php | 7 +- includes/SpecialPage.php | 1 - languages/messages/MessagesEn.php | 9 -- maintenance/language/messages.inc | 10 -- 6 files changed, 2 insertions(+), 235 deletions(-) delete mode 100644 includes/SpecialActiveusers.php diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index b37ca449f3..43beaf328f 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2592,7 +2592,6 @@ $wgSpecialPageGroups = array( 'Filepath' => 'media', 'Listusers' => 'users', - 'Activeusers' => 'users', 'Listgrouprights' => 'users', 'Ipblocklist' => 'users', 'Contributions' => 'users', diff --git a/includes/SpecialActiveusers.php b/includes/SpecialActiveusers.php deleted file mode 100644 index f5390938b8..0000000000 --- a/includes/SpecialActiveusers.php +++ /dev/null @@ -1,209 +0,0 @@ -getText( 'username' ); - $this->requestedUser = ''; - if ( $un != '' ) { - $username = Title::makeTitleSafe( NS_USER, $un ); - if( ! is_null( $username ) ) { - $this->requestedUser = $username->getText(); - } - } - parent::__construct(); - } - - - function getIndexField() { - return 'rc_user_text'; - } - - function getQueryInfo() { - $dbr = wfGetDB( DB_SLAVE ); - $conds=array(); - // don't show hidden names - $conds[]='ipb_deleted IS NULL OR ipb_deleted = 0'; - $useIndex = $dbr->useIndexClause('rc_user_text'); - if ($this->requestedUser != "") { - $conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser ); - } - - list ($recentchanges,$ipblocks) = $dbr->tableNamesN('recentchanges','ipblocks'); - - $query = array( - 'tables' => " $recentchanges $useIndex - LEFT JOIN $ipblocks ON rc_user=ipb_user AND ipb_auto=0 ", - 'fields' => array('rc_user_text', - 'MAX(rc_user) AS user_id', - 'COUNT(*) AS recentedits', - 'MAX(ipb_user) AS blocked'), - 'options' => array('GROUP BY' => 'rc_user_text'), - 'conds' => $conds - ); - - return $query; - } - - function formatRow( $row ) { - $userPage = Title::makeTitle( NS_USER, $row->rc_user_text ); - $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ); - - $list = array(); - foreach( self::getGroups( $row->user_id ) as $group ) - $list[] = self::buildGroupLink( $group ); - $groups = implode( ', ', $list ); - - $item = wfSpecialList( $name, $groups ); - $count = wfMsgHtml( 'activeusers-count', $row->recentedits ); - $blocked = $row->blocked ? ' '.wfMsg('listusers-blocked') : ''; - - return "
  • {$item} [{$count}]{$blocked}
  • "; - } - - function getBody() { - if (!$this->mQueryDone) { - $this->doQuery(); - } - $batch = new LinkBatch(); - - $this->mResult->rewind(); - while ( $row = $this->mResult->fetchObject() ) { - $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rc_user_text ) ); - } - $batch->execute(); - $this->mResult->rewind(); - - return parent::getBody(); - } - - function getPageHeader( ) { - global $wgScript, $wgRequest; - $self = $this->getTitle(); - - # Form tag - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . - '
    ' . - Xml::element( 'legend', array(), wfMsg( 'activeusers' ) ); - $out .= Xml::hidden( 'title', $self->getPrefixedDbKey() ); - - # Username field - $out .= Xml::label( wfMsg( 'activeusers-from' ), 'offset' ) . ' ' . - Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' '; - - # Submit button and form bottom - if( $this->mLimit ) - $out .= Xml::hidden( 'limit', $this->mLimit ); - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ); - - $out .= '
    ' . - Xml::closeElement( 'form' ); - - return $out; - } - - function getAllGroups() { - $result = array(); - foreach( User::getAllGroups() as $group ) { - $result[$group] = User::getGroupName( $group ); - } - return $result; - } - - /** - * Preserve group and username offset parameters when paging - * @return array - */ - function getDefaultQuery() { - $query = parent::getDefaultQuery(); - if( $this->requestedUser != '' ) - $query['username'] = $this->requestedUser; - return $query; - } - - /** - * Get a list of groups the specified user belongs to - * - * @param int $uid - * @return array - */ - protected static function getGroups( $uid ) { - $dbr = wfGetDB( DB_SLAVE ); - $groups = array(); - $res = $dbr->select( 'user_groups', 'ug_group', array( 'ug_user' => $uid ), __METHOD__ ); - if( $res && $dbr->numRows( $res ) > 0 ) { - while( $row = $dbr->fetchObject( $res ) ) - $groups[] = $row->ug_group; - $dbr->freeResult( $res ); - } - return $groups; - } - - /** - * Format a link to a group description page - * - * @param string $group - * @return string - */ - protected static function buildGroupLink( $group ) { - static $cache = array(); - if( !isset( $cache[$group] ) ) - $cache[$group] = User::makeGroupLinkHtml( $group, User::getGroupMember( $group ) ); - return $cache[$group]; - } -} - -/** - * constructor - * $par string (optional) A group to list users from - */ -function wfSpecialActiveusers( $par = null ) { - global $wgRequest, $wgOut; - - $up = new ActiveUsersPager(); - - # getBody() first to check, if empty - $usersbody = $up->getBody(); - $s = $up->getPageHeader(); - if( $usersbody ) { - $s .= $up->getNavigationBar(); - $s .= ''; - $s .= $up->getNavigationBar() ; - } else { - $s .= '

    ' . wfMsgHTML('activeusers-noresult') . '

    '; - }; - - $wgOut->addHTML( $s ); -} diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 6c279bbfff..8d99cf21a4 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -78,8 +78,7 @@ class UsersPager extends AlphabeticPager { 'fields' => array('user_name', 'MAX(user_id) AS user_id', 'COUNT(ug_group) AS numgroups', - 'MAX(ug_group) AS singlegroup', - 'MAX(ipb_user) AS blocked'), + 'MAX(ug_group) AS singlegroup'), 'options' => array('GROUP BY' => 'user_name'), 'conds' => $conds ); @@ -104,10 +103,8 @@ class UsersPager extends AlphabeticPager { } $item = wfSpecialList( $name, $groups ); - $blocked = $row->blocked ? ' '.wfMsg('listusers-blocked') : ''; - wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); - return "
  • {$item}{$blocked}
  • "; + return "
  • {$item}
  • "; } function getBody() { diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 6dc4d64a0d..e8fe3ca64b 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -93,7 +93,6 @@ class SpecialPage 'Imagelist' => array( 'SpecialPage', 'Imagelist' ), 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ), 'Listusers' => array( 'SpecialPage', 'Listusers' ), - 'Activeusers' => array( 'SpecialPage', 'Activeusers' ), 'Listgrouprights' => 'SpecialListGroupRights', 'Statistics' => array( 'SpecialPage', 'Statistics' ), 'Randompage' => 'Randompage', diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 6b6bb49b6c..704569c0aa 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1888,8 +1888,6 @@ A page is treated as disambiguation page if it uses a template which is linked f 'protectedtitlesempty' => 'No titles are currently protected with these parameters.', 'listusers' => 'User list', 'listusers-summary' => '', # only translate this message to other languages if you have to change it -'activeusers' => 'Active user list', -'activeusers-summary' => '', # only translate this message to other languages if you have to change it 'specialpages' => 'Special pages', 'specialpages-summary' => '', # only translate this message to other languages if you have to change it 'spheading' => 'Special pages for all users', @@ -1953,16 +1951,9 @@ It may contain one or more characters which cannot be used in titles.', # Special:Listusers 'listusersfrom' => 'Display users starting at:', -'listusers-blocked' => '(account blocked)', 'listusers-submit' => 'Show', 'listusers-noresult' => 'No user found.', -# Special:Activeusers -'activeusers-count' => '$1 recent edits', -'activeusers-from' => 'Display users starting at:', -'activeusers-submit' => 'Show', -'activeusers-noresult' => 'No user found.', - # Special:Listgrouprights 'listgrouprights' => 'User group rights', 'listgrouprights-summary' => 'The following is a list of user groups defined on this wiki, with their associated access rights. diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index b97a10b5b1..678737526b 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1218,9 +1218,6 @@ $wgMessageStructure = array( 'protectedtitlesempty', 'listusers', 'listusers-summary', - 'ativeusers', - 'ativeusers-summary', - 'specialpages', 'specialpages-summary', 'spheading', @@ -1284,13 +1281,6 @@ $wgMessageStructure = array( 'listusersfrom', 'listusers-submit', 'listusers-noresult', - 'listusers-blocked' - ), - 'activeusers' => array( - 'activeusers-count', - 'activeusers-from', - 'activeusers-submit', - 'activeusers-noresult', ), 'listgrouprights' => array( 'listgrouprights', -- 2.20.1