MediaWiki master
SpecialListUsers.php
Go to the documentation of this file.
1<?php
11namespace MediaWiki\Specials;
12
14use MediaWiki\Cache\LinkBatchFactory;
22
29
30 private LinkBatchFactory $linkBatchFactory;
31 private IConnectionProvider $dbProvider;
32 private UserGroupManager $userGroupManager;
33 private UserIdentityLookup $userIdentityLookup;
34 private HideUserUtils $hideUserUtils;
35 private TempUserConfig $tempUserConfig;
36
37 public function __construct(
38 LinkBatchFactory $linkBatchFactory,
39 IConnectionProvider $dbProvider,
40 UserGroupManager $userGroupManager,
41 UserIdentityLookup $userIdentityLookup,
42 HideUserUtils $hideUserUtils,
43 TempUserConfig $tempUserConfig
44 ) {
45 parent::__construct( 'Listusers' );
46 $this->linkBatchFactory = $linkBatchFactory;
47 $this->dbProvider = $dbProvider;
48 $this->userGroupManager = $userGroupManager;
49 $this->userIdentityLookup = $userIdentityLookup;
50 $this->hideUserUtils = $hideUserUtils;
51 $this->tempUserConfig = $tempUserConfig;
52 }
53
57 public function execute( $par ) {
58 $this->setHeaders();
59 $this->outputHeader();
60
61 $up = new UsersPager(
62 $this->getContext(),
63 $this->getHookContainer(),
64 $this->linkBatchFactory,
65 $this->dbProvider,
66 $this->userGroupManager,
67 $this->userIdentityLookup,
68 $this->hideUserUtils,
69 $this->tempUserConfig,
70 $par,
71 $this->including()
72 );
73
74 # getBody() first to check, if empty
75 $usersbody = $up->getBody();
76
77 $s = '';
78 if ( !$this->including() ) {
79 $s = $up->getPageHeader();
80 }
81
82 if ( $usersbody ) {
83 $s .= $up->getNavigationBar();
84 $s .= Html::rawElement( 'ul', [], $usersbody );
85 $s .= $up->getNavigationBar();
86 } else {
87 $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
88 }
89
90 $out = $this->getOutput();
91 $out->addHTML( $s );
92 $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
93 }
94
100 public function getSubpagesForPrefixSearch() {
101 return $this->userGroupManager->listAllGroups();
102 }
103
105 protected function getGroupName() {
106 return 'users';
107 }
108}
109
111class_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
This class is used to get a list of user.
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(LinkBatchFactory $linkBatchFactory, IConnectionProvider $dbProvider, UserGroupManager $userGroupManager, UserIdentityLookup $userIdentityLookup, HideUserUtils $hideUserUtils, 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.