MediaWiki master
SpecialListUsers.php
Go to the documentation of this file.
1<?php
28namespace MediaWiki\Specials;
29
38
43
44 private LinkBatchFactory $linkBatchFactory;
45 private IConnectionProvider $dbProvider;
46 private UserGroupManager $userGroupManager;
47 private UserIdentityLookup $userIdentityLookup;
48 private HideUserUtils $hideUserUtils;
49
57 public function __construct(
58 LinkBatchFactory $linkBatchFactory,
59 IConnectionProvider $dbProvider,
60 UserGroupManager $userGroupManager,
61 UserIdentityLookup $userIdentityLookup,
62 HideUserUtils $hideUserUtils
63 ) {
64 parent::__construct( 'Listusers' );
65 $this->linkBatchFactory = $linkBatchFactory;
66 $this->dbProvider = $dbProvider;
67 $this->userGroupManager = $userGroupManager;
68 $this->userIdentityLookup = $userIdentityLookup;
69 $this->hideUserUtils = $hideUserUtils;
70 }
71
75 public function execute( $par ) {
76 $this->setHeaders();
77 $this->outputHeader();
78
79 $up = new UsersPager(
80 $this->getContext(),
81 $this->getHookContainer(),
82 $this->linkBatchFactory,
83 $this->dbProvider,
84 $this->userGroupManager,
85 $this->userIdentityLookup,
86 $this->hideUserUtils,
87 $par,
88 $this->including()
89 );
90
91 # getBody() first to check, if empty
92 $usersbody = $up->getBody();
93
94 $s = '';
95 if ( !$this->including() ) {
96 $s = $up->getPageHeader();
97 }
98
99 if ( $usersbody ) {
100 $s .= $up->getNavigationBar();
101 $s .= Html::rawElement( 'ul', [], $usersbody );
102 $s .= $up->getNavigationBar();
103 } else {
104 $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
105 }
106
107 $out = $this->getOutput();
108 $out->addHTML( $s );
109 $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
110 }
111
117 public function getSubpagesForPrefixSearch() {
118 return $this->userGroupManager->listAllGroups();
119 }
120
121 protected function getGroupName() {
122 return 'users';
123 }
124}
125
127class_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 Per default the message key is the canonical name o...
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.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...