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 ) {
$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' )
$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 != '' ) {
'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(),
$user = User::newFromId( $uid );
return $user->getGroupMemberships();
} else {
- return isset( $cache[$uid] ) ? $cache[$uid] : [];
+ return $cache[$uid] ?? [];
}
}