MediaWiki REL1_41
SpecialListUsers.php
Go to the documentation of this file.
1<?php
28namespace MediaWiki\Specials;
29
37
42
43 private LinkBatchFactory $linkBatchFactory;
44 private IConnectionProvider $dbProvider;
45 private UserGroupManager $userGroupManager;
46 private UserIdentityLookup $userIdentityLookup;
47
54 public function __construct(
55 LinkBatchFactory $linkBatchFactory,
56 IConnectionProvider $dbProvider,
57 UserGroupManager $userGroupManager,
58 UserIdentityLookup $userIdentityLookup
59 ) {
60 parent::__construct( 'Listusers' );
61 $this->linkBatchFactory = $linkBatchFactory;
62 $this->dbProvider = $dbProvider;
63 $this->userGroupManager = $userGroupManager;
64 $this->userIdentityLookup = $userIdentityLookup;
65 }
66
70 public function execute( $par ) {
71 $this->setHeaders();
72 $this->outputHeader();
73
74 $up = new UsersPager(
75 $this->getContext(),
76 $this->getHookContainer(),
77 $this->linkBatchFactory,
78 $this->dbProvider,
79 $this->userGroupManager,
80 $this->userIdentityLookup,
81 $par,
82 $this->including()
83 );
84
85 # getBody() first to check, if empty
86 $usersbody = $up->getBody();
87
88 $s = '';
89 if ( !$this->including() ) {
90 $s = $up->getPageHeader();
91 }
92
93 if ( $usersbody ) {
94 $s .= $up->getNavigationBar();
95 $s .= Html::rawElement( 'ul', [], $usersbody );
96 $s .= $up->getNavigationBar();
97 } else {
98 $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
99 }
100
101 $out = $this->getOutput();
102 $out->addHTML( $s );
103 $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
104 }
105
111 public function getSubpagesForPrefixSearch() {
112 return $this->userGroupManager->listAllGroups();
113 }
114
115 protected function getGroupName() {
116 return 'users';
117 }
118}
119
123class_alias( SpecialListUsers::class, 'SpecialListUsers' );
This class is a collection of static functions that serve two purposes:
Definition Html.php:57
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)
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...