Glaisher has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231796

Change subject: Cleanup SpecialGlobalUsers and GlobalUsersPager
......................................................................

Cleanup SpecialGlobalUsers and GlobalUsersPager

* Make GlobalUsersPager::$requestedGroup/$requestedUser protected;
    looks like a relic from the past when UsersPager was used
* Set explicit visibility
* Remove gug_singlegroup from query; not used anywhere now
* Fix documentation

Change-Id: I1aad928c24024b8b1fb677ba16fa99e0b0c844da
---
M includes/specials/SpecialGlobalUsers.php
1 file changed, 17 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/96/231796/1

diff --git a/includes/specials/SpecialGlobalUsers.php 
b/includes/specials/SpecialGlobalUsers.php
index cc00eff..657a94a 100644
--- a/includes/specials/SpecialGlobalUsers.php
+++ b/includes/specials/SpecialGlobalUsers.php
@@ -10,6 +10,7 @@
                $this->setHeaders();
 
                $pg = new GlobalUsersPager( $this->getContext(), $par );
+               $req = $this->getRequest();
 
                if ( $par ) {
                        if( in_array( $par, 
CentralAuthUser::availableGlobalGroups() ) ) {
@@ -18,7 +19,8 @@
                                $pg->setUsername( $par );
                        }
                }
-               $rqGroup = $this->getRequest()->getVal( 'group' );
+
+               $rqGroup = $req->getVal( 'group' );
                if ( $rqGroup ) {
                                $groupTitle = Title::newFromText( $rqGroup );
                                if ( $groupTitle ) {
@@ -26,16 +28,18 @@
                                }
                }
 
-               $rqUsername = $wgContLang->ucfirst( 
$this->getRequest()->getVal( 'username' ) );
+               $rqUsername = $wgContLang->ucfirst( $req->getVal( 'username' ) 
);
                if ( $rqUsername ) {
                        $pg->setUsername( $rqUsername );
                }
 
                $this->getOutput()->addModuleStyles( 
'ext.centralauth.globalusers' );
-               $this->getOutput()->addHTML( $pg->getPageHeader() );
-               $this->getOutput()->addHTML( $pg->getNavigationBar() );
-               $this->getOutput()->addHTML( Html::rawElement( 'ul', null, 
$pg->getBody() ) );
-               $this->getOutput()->addHTML( $pg->getNavigationBar() );
+               $this->getOutput()->addHTML(
+                       $pg->getPageHeader() .
+                       $pg->getNavigationBar() .
+                       Html::rawElement( 'ul', array(), $pg->getBody() ) .
+                       $pg->getNavigationBar()
+               );
        }
 
        protected function getGroupName() {
@@ -44,7 +48,8 @@
 }
 
 class GlobalUsersPager extends AlphabeticPager {
-       public $requestedGroup = false, $requestedUser;
+       protected $requestedGroup = false;
+       protected $requestedUser = false;
        private $wikiSets = array();
 
        function __construct( IContextSource $context = null, $par = null ) {
@@ -55,9 +60,8 @@
 
        /**
         * @param $group string
-        * @return mixed
         */
-       function setGroup( $group = '' ) {
+       public function setGroup( $group = '' ) {
                if ( !$group ) {
                        $this->requestedGroup = false;
                        return;
@@ -67,9 +71,8 @@
 
        /**
         * @param $username string
-        * @return mixed
         */
-       function setUsername( $username = '' ) {
+       public function setUsername( $username = '' ) {
                if ( !$username ) {
                        $this->requestedUser = false;
                        return;
@@ -99,7 +102,6 @@
         * @return array
         */
        function getQueryInfo() {
-               $localwiki = wfWikiID();
                $conds = array( 'gu_hidden' => CentralAuthUser::HIDDEN_NONE );
 
                if ( $this->requestedGroup ) {
@@ -112,11 +114,11 @@
 
                return array(
                        'tables' => array( 'globaluser', 'localuser', 
'global_user_groups' ),
-                       'fields' => array( 'gu_id', 'gu_name', 'gu_locked', 
'lu_attached_method', 'COUNT(gug_group) AS gug_numgroups', 'MAX(gug_group) AS 
gug_singlegroup'  ),
+                       'fields' => array( 'gu_id', 'gu_name', 'gu_locked', 
'lu_attached_method', 'gug_numgroups' => 'COUNT(gug_group)' ),
                        'conds' => $conds,
                        'options' => array( 'GROUP BY' => 'gu_name' ),
                        'join_conds' => array(
-                               'localuser' => array( 'LEFT JOIN', array( 
'gu_name = lu_name', 'lu_wiki' => $localwiki ) ),
+                               'localuser' => array( 'LEFT JOIN', array( 
'gu_name = lu_name', 'lu_wiki' => wfWikiID() ) ),
                                'global_user_groups' => array( 'LEFT JOIN', 
'gu_id = gug_user' )
                        ),
                );
@@ -214,7 +216,7 @@
        }
 
        /**
-        * @return String
+        * @return string
         */
        function getBody() {
                if ( !$this->mQueryDone ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/231796
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1aad928c24024b8b1fb677ba16fa99e0b0c844da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to