MediaWiki master
SpecialListUsers.php
Go to the documentation of this file.
1<?php
11namespace MediaWiki\Specials;
12
16use MediaWiki\Pager\UsersPager;
22
29
30 public function __construct(
31 private readonly LinkBatchFactory $linkBatchFactory,
32 private readonly IConnectionProvider $dbProvider,
33 private readonly UserGroupManager $userGroupManager,
34 private readonly UserIdentityLookup $userIdentityLookup,
35 private readonly HideUserUtils $hideUserUtils,
36 private readonly TempUserConfig $tempUserConfig,
37 ) {
38 parent::__construct( 'Listusers' );
39 }
40
44 public function execute( $par ) {
45 $this->setHeaders();
46 $this->outputHeader();
47
48 $up = new UsersPager(
49 $this->getContext(),
50 $this->getHookContainer(),
51 $this->linkBatchFactory,
52 $this->dbProvider,
53 $this->userGroupManager,
54 $this->userIdentityLookup,
55 $this->hideUserUtils,
56 $this->tempUserConfig,
57 $par,
58 $this->including()
59 );
60
61 # getBody() first to check, if empty
62 $usersbody = $up->getBody();
63
64 $s = '';
65 if ( !$this->including() ) {
66 $s = $up->getPageHeader();
67 }
68
69 if ( $usersbody ) {
70 $s .= $up->getNavigationBar();
71 $s .= Html::rawElement( 'ul', [], $usersbody );
72 $s .= $up->getNavigationBar();
73 } else {
74 $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
75 }
76
77 $out = $this->getOutput();
78 $out->addHTML( $s );
79 $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
80 }
81
87 public function getSubpagesForPrefixSearch() {
88 return $this->userGroupManager->listAllGroups();
89 }
90
92 protected function getGroupName() {
93 return 'users';
94 }
95}
96
98class_alias( SpecialListUsers::class, 'SpecialListUsers' );
Helpers for building queries that determine whether a user is hidden.
This class is a collection of static functions that serve two purposes:
Definition Html.php:43
Factory for LinkBatch objects to batch query page metadata.
Shortcut to construct an includable special page.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
including( $x=null)
Whether the special page is being evaluated via transclusion.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...
Implements Special:Listusers.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
__construct(private readonly LinkBatchFactory $linkBatchFactory, private readonly IConnectionProvider $dbProvider, private readonly UserGroupManager $userGroupManager, private readonly UserIdentityLookup $userIdentityLookup, private readonly HideUserUtils $hideUserUtils, private readonly TempUserConfig $tempUserConfig,)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Manage user group memberships.
Interface for temporary user creation config and name matching.
Service for looking up UserIdentity.
Provide primary and replica IDatabase connections.