52 $par = ( $par !== null ) ? $par :
'';
53 $parms = explode(
'/', $par );
54 $symsForAll = [
'*',
'user' ];
56 if ( $parms[0] !=
'' &&
59 $this->requestedGroup = $par;
60 $un =
$request->getText(
'username' );
61 } elseif ( count( $parms ) == 2 ) {
62 $this->requestedGroup = $parms[0];
65 $this->requestedGroup =
$request->getVal(
'group' );
66 $un = ( $par !=
'' ) ? $par :
$request->getText(
'username' );
69 if ( in_array( $this->requestedGroup, $symsForAll ) ) {
70 $this->requestedGroup =
'';
72 $this->editsOnly =
$request->getBool(
'editsOnly' );
73 $this->creationSort =
$request->getBool(
'creationSort' );
74 $this->including = $including;
75 $this->mDefaultDirection =
$request->getBool(
'desc' )
79 $this->requestedUser =
'';
82 $username = Title::makeTitleSafe( NS_USER, $un );
85 $this->requestedUser =
$username->getText();
89 parent::__construct();
96 return $this->creationSort ?
'user_id' :
'user_name';
107 if ( !$this->
getUser()->isAllowed(
'hideuser' ) ) {
108 $conds[] =
'ipb_deleted IS NULL OR ipb_deleted = 0';
113 if ( $this->requestedGroup !=
'' ) {
114 $conds[
'ug_group'] = $this->requestedGroup;
115 $conds[] =
'ug_expiry IS NULL OR ug_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() );
118 if ( $this->requestedUser !=
'' ) {
119 # Sorted either by account creation or name
120 if ( $this->creationSort ) {
121 $conds[] =
'user_id >= ' . intval(
User::idFromName( $this->requestedUser ) );
123 $conds[] =
'user_name >= ' .
$dbr->addQuotes( $this->requestedUser );
127 if ( $this->editsOnly ) {
128 $conds[] =
'user_editcount > 0';
131 $options[
'GROUP BY'] = $this->creationSort ?
'user_id' :
'user_name';
134 'tables' => [
'user',
'user_groups',
'ipblocks' ],
136 'user_name' => $this->creationSort ?
'MAX(user_name)' :
'user_name',
137 'user_id' => $this->creationSort ?
'user_id' :
'MAX(user_id)',
138 'edits' =>
'MAX(user_editcount)',
139 'creation' =>
'MIN(user_registration)',
140 'ipb_deleted' =>
'MAX(ipb_deleted)'
144 'user_groups' => [
'LEFT JOIN',
'user_id=ug_user' ],
155 Hooks::run(
'SpecialListusersQueryInfo', [ $this, &
$query ] );
165 if ( $row->user_id == 0 ) { # T18487
169 $userName = $row->user_name;
183 if ( !$this->including && count( $ugms ) > 0 ) {
185 foreach ( $ugms as $ugm ) {
188 $groups =
$lang->commaList( $list );
191 $item =
$lang->specialList( $ulinks, $groups );
193 if ( $row->ipb_deleted ) {
194 $item =
"<span class=\"deleted\">$item</span>";
198 if ( !$this->including && $this->
getConfig()->
get(
'Edititis' ) ) {
199 $count = $this->
msg(
'usereditcount' )->numParams( $row->edits )->escaped();
200 $edits = $this->
msg(
'word-separator' )->escaped() . $this->
msg(
'brackets', $count )->escaped();
204 # Some rows may be null
205 if ( !$this->including && $row->creation ) {
207 $d =
$lang->userDate( $row->creation, $user );
208 $t =
$lang->userTime( $row->creation, $user );
209 $created = $this->
msg(
'usercreated', $d,
$t, $row->user_name )->escaped();
210 $created =
' ' . $this->
msg(
'parentheses' )->rawParams( $created )->escaped();
212 $blocked = !is_null( $row->ipb_deleted ) ?
213 ' ' . $this->
msg(
'listusers-blocked', $userName )->escaped() :
216 Hooks::run(
'SpecialListusersFormatRow', [ &$item, $row ] );
218 return Html::rawElement(
'li', [],
"{$item}{$edits}{$created}{$blocked}" );
224 # Give some pointers to make user links
225 foreach ( $this->mResult as $row ) {
226 $batch->add( NS_USER, $row->user_name );
228 $userIds[] = $row->user_id;
233 $groupRes =
$dbr->select(
235 UserGroupMembership::selectFields(),
236 [
'ug_user' => $userIds ],
241 foreach ( $groupRes as $row ) {
242 $ugm = UserGroupMembership::newFromRow( $row );
243 if ( !$ugm->isExpired() ) {
244 $cache[$row->ug_user][$row->ug_group] = $ugm;
245 $groups[$row->ug_group] =
true;
251 Hooks::run(
'UsersPagerDoBatchLookups', [
$dbr, $userIds, &
$cache, &$groups ] );
253 $this->userGroupCache =
$cache;
256 foreach ( $groups as $group => $unused ) {
257 $groupPage = UserGroupMembership::getGroupPage( $group );
259 $batch->addObj( $groupPage );
264 $this->mResult->rewind();
273 $groupOptions = [ $this->
msg(
'group-all' )->text() =>
'' ];
274 foreach ( $this->
getAllGroups() as $group => $groupText ) {
275 $groupOptions[ $groupText ] = $group;
280 'class' => HTMLUserTextField::class,
281 'label' => $this->
msg(
'listusersfrom' )->text(),
282 'name' =>
'username',
283 'default' => $this->requestedUser,
286 'label' => $this->
msg(
'group' )->text(),
288 'default' => $this->requestedGroup,
289 'class' => HTMLSelectField::class,
290 'options' => $groupOptions,
294 'label' => $this->
msg(
'listusers-editsonly' )->text(),
295 'name' =>
'editsOnly',
297 'default' => $this->editsOnly
301 'label' => $this->
msg(
'listusers-creationsort' )->text(),
302 'name' =>
'creationSort',
303 'id' =>
'creationSort',
304 'default' => $this->creationSort
308 'label' => $this->
msg(
'listusers-desc' )->text(),
313 'limithiddenfield' => [
314 'class' => HTMLHiddenField::class,
320 $beforeSubmitButtonHookOut =
'';
321 Hooks::run(
'SpecialListusersHeaderForm', [ $this, &$beforeSubmitButtonHookOut ] );
323 if ( $beforeSubmitButtonHookOut !==
'' ) {
324 $formDescriptor[
'beforeSubmitButtonHookOut' ] = [
325 'class' => HTMLInfoField::class,
327 'default' => $beforeSubmitButtonHookOut
331 $formDescriptor[
'submit' ] = [
332 'class' => HTMLSubmitField::class,
333 'buttonlabel-message' =>
'listusers-submit',
336 $beforeClosingFieldsetHookOut =
'';
337 Hooks::run(
'SpecialListusersHeader', [ $this, &$beforeClosingFieldsetHookOut ] );
339 if ( $beforeClosingFieldsetHookOut !==
'' ) {
340 $formDescriptor[
'beforeClosingFieldsetHookOut' ] = [
341 'class' => HTMLInfoField::class,
343 'default' => $beforeClosingFieldsetHookOut
347 $htmlForm = HTMLForm::factory(
'ooui', $formDescriptor, $this->
getContext() );
350 ->setAction( Title::newFromText(
$self )->getLocalURL() )
351 ->setId(
'mw-listusers-form' )
352 ->setFormIdentifier(
'mw-listusers-form' )
353 ->suppressDefaultSubmit()
354 ->setWrapperLegendMsg(
'listusers' );
355 return $htmlForm->prepareForm()->getHTML(
true );
365 $result[$group] = UserGroupMembership::getGroupName( $group );
377 $query = parent::getDefaultQuery();
378 if ( $this->requestedGroup !=
'' ) {
379 $query[
'group'] = $this->requestedGroup;
381 if ( $this->requestedUser !=
'' ) {
382 $query[
'username'] = $this->requestedUser;
384 Hooks::run(
'SpecialListusersDefaultQuery', [ $this, &
$query ] );
400 return $user->getGroupMemberships();
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static userToolLinksRedContribs( $userId, $userText, $edits=null)
Alias for userToolLinks( $userId, $userText, true );.
static getAllGroups()
Return the set of defined explicit groups.
static newFromId( $id)
Static factory method for creation from a given user ID.
static idFromName( $name, $flags=self::READ_NORMAL)
Get database id given a user name.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
namespace being checked & $result
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
this hook is for auditing only or null if authentication failed before getting that far $username
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Interface for objects which can provide a MediaWiki context on request.
if(!isset( $args[0])) $lang