Merge "[MCR] Make PageArchive aware of MCR"
[lhc/web/wiklou.git] / includes / specials / pagers / UsersPager.php
index 09d4b5e..aa757e6 100644 (file)
@@ -38,9 +38,9 @@ class UsersPager extends AlphabeticPager {
        protected $userGroupCache;
 
        /**
-        * @param IContextSource $context
-        * @param array $par (Default null)
-        * @param bool $including Whether this page is being transcluded in
+        * @param IContextSource|null $context
+        * @param array|null $par (Default null)
+        * @param bool|null $including Whether this page is being transcluded in
         * another page
         */
        function __construct( IContextSource $context = null, $par = null, $including = null ) {
@@ -70,6 +70,7 @@ class UsersPager extends AlphabeticPager {
                        $this->requestedGroup = '';
                }
                $this->editsOnly = $request->getBool( 'editsOnly' );
+               $this->temporaryGroupsOnly = $request->getBool( 'temporaryGroupsOnly' );
                $this->creationSort = $request->getBool( 'creationSort' );
                $this->including = $including;
                $this->mDefaultDirection = $request->getBool( 'desc' )
@@ -110,9 +111,13 @@ class UsersPager extends AlphabeticPager {
 
                $options = [];
 
+               if ( $this->requestedGroup != '' || $this->temporaryGroupsOnly ) {
+                       $conds[] = 'ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ) .
+                       ( !$this->temporaryGroupsOnly ? ' OR ug_expiry IS NULL' : '' );
+               }
+
                if ( $this->requestedGroup != '' ) {
                        $conds['ug_group'] = $this->requestedGroup;
-                       $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() );
                }
 
                if ( $this->requestedUser != '' ) {
@@ -296,6 +301,13 @@ class UsersPager extends AlphabeticPager {
                                'id' => 'editsOnly',
                                'default' => $this->editsOnly
                        ],
+                       'temporaryGroupsOnly' => [
+                               'type' => 'check',
+                               'label' => $this->msg( 'listusers-temporarygroupsonly' )->text(),
+                               'name' => 'temporaryGroupsOnly',
+                               'id' => 'temporaryGroupsOnly',
+                               'default' => $this->temporaryGroupsOnly
+                       ],
                        'creationSort' => [
                                'type' => 'check',
                                'label' => $this->msg( 'listusers-creationsort' )->text(),
@@ -399,7 +411,7 @@ class UsersPager extends AlphabeticPager {
                        $user = User::newFromId( $uid );
                        return $user->getGroupMemberships();
                } else {
-                       return isset( $cache[$uid] ) ? $cache[$uid] : [];
+                       return $cache[$uid] ?? [];
                }
        }