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 != '' ) {
$formDescriptor = [
'user' => [
- 'class' => 'HTMLUserTextField',
+ 'class' => HTMLUserTextField::class,
'label' => $this->msg( 'listusersfrom' )->text(),
'name' => 'username',
'default' => $this->requestedUser,
'label' => $this->msg( 'group' )->text(),
'name' => 'group',
'default' => $this->requestedGroup,
- 'class' => 'HTMLSelectField',
+ 'class' => HTMLSelectField::class,
'options' => $groupOptions,
],
'editsOnly' => [
'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(),
'default' => $this->mDefaultDirection
],
'limithiddenfield' => [
- 'class' => 'HTMLHiddenField',
+ 'class' => HTMLHiddenField::class,
'name' => 'limit',
'default' => $this->mLimit
]
if ( $beforeSubmitButtonHookOut !== '' ) {
$formDescriptior[ 'beforeSubmitButtonHookOut' ] = [
- 'class' => 'HTMLInfoField',
+ 'class' => HTMLInfoField::class,
'raw' => true,
'default' => $beforeSubmitButtonHookOut
];
}
$formDescriptor[ 'submit' ] = [
- 'class' => 'HTMLSubmitField',
+ 'class' => HTMLSubmitField::class,
'buttonlabel-message' => 'listusers-submit',
];
if ( $beforeClosingFieldsetHookOut !== '' ) {
$formDescriptior[ 'beforeClosingFieldsetHookOut' ] = [
- 'class' => 'HTMLInfoField',
+ 'class' => HTMLInfoField::class,
'raw' => true,
'default' => $beforeClosingFieldsetHookOut
];
$user = User::newFromId( $uid );
return $user->getGroupMemberships();
} else {
- return isset( $cache[$uid] ) ? $cache[$uid] : [];
+ return $cache[$uid] ?? [];
}
}