MediaWiki master
SpecialListUsers.php
Go to the documentation of this file.
1<?php
25namespace MediaWiki\Specials;
26
35
42
43 private LinkBatchFactory $linkBatchFactory;
44 private IConnectionProvider $dbProvider;
45 private UserGroupManager $userGroupManager;
46 private UserIdentityLookup $userIdentityLookup;
47 private HideUserUtils $hideUserUtils;
48
56 public function __construct(
57 LinkBatchFactory $linkBatchFactory,
58 IConnectionProvider $dbProvider,
59 UserGroupManager $userGroupManager,
60 UserIdentityLookup $userIdentityLookup,
61 HideUserUtils $hideUserUtils
62 ) {
63 parent::__construct( 'Listusers' );
64 $this->linkBatchFactory = $linkBatchFactory;
65 $this->dbProvider = $dbProvider;
66 $this->userGroupManager = $userGroupManager;
67 $this->userIdentityLookup = $userIdentityLookup;
68 $this->hideUserUtils = $hideUserUtils;
69 }
70
74 public function execute( $par ) {
75 $this->setHeaders();
76 $this->outputHeader();
77
78 $up = new UsersPager(
79 $this->getContext(),
80 $this->getHookContainer(),
81 $this->linkBatchFactory,
82 $this->dbProvider,
83 $this->userGroupManager,
84 $this->userIdentityLookup,
85 $this->hideUserUtils,
86 $par,
87 $this->including()
88 );
89
90 # getBody() first to check, if empty
91 $usersbody = $up->getBody();
92
93 $s = '';
94 if ( !$this->including() ) {
95 $s = $up->getPageHeader();
96 }
97
98 if ( $usersbody ) {
99 $s .= $up->getNavigationBar();
100 $s .= Html::rawElement( 'ul', [], $usersbody );
101 $s .= $up->getNavigationBar();
102 } else {
103 $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
104 }
105
106 $out = $this->getOutput();
107 $out->addHTML( $s );
108 $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
109 }
110
116 public function getSubpagesForPrefixSearch() {
117 return $this->userGroupManager->listAllGroups();
118 }
119
120 protected function getGroupName() {
121 return 'users';
122 }
123}
124
126class_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:56
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)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Provide primary and replica IDatabase connections.