Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 36 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| SpecialListUsers | |
0.00% |
0 / 35 |
|
0.00% |
0 / 4 |
42 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 26 |
|
0.00% |
0 / 1 |
12 | |||
| getSubpagesForPrefixSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Copyright © 2004 Brooke Vibber, lcrocker, Tim Starling, |
| 4 | * Domas Mituzas, Antoine Musso, Jens Frank, Zhengzhu, |
| 5 | * 2006 Rob Church <robchur@gmail.com> |
| 6 | * |
| 7 | * @license GPL-2.0-or-later |
| 8 | * @file |
| 9 | */ |
| 10 | |
| 11 | namespace MediaWiki\Specials; |
| 12 | |
| 13 | use MediaWiki\Block\HideUserUtils; |
| 14 | use MediaWiki\Html\Html; |
| 15 | use MediaWiki\Page\LinkBatchFactory; |
| 16 | use MediaWiki\Pager\UsersPager; |
| 17 | use MediaWiki\SpecialPage\IncludableSpecialPage; |
| 18 | use MediaWiki\User\TempUser\TempUserConfig; |
| 19 | use MediaWiki\User\UserGroupManager; |
| 20 | use MediaWiki\User\UserIdentityLookup; |
| 21 | use Wikimedia\Rdbms\IConnectionProvider; |
| 22 | |
| 23 | /** |
| 24 | * Implements Special:Listusers |
| 25 | * |
| 26 | * @ingroup SpecialPage |
| 27 | */ |
| 28 | class SpecialListUsers extends IncludableSpecialPage { |
| 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 | |
| 54 | /** |
| 55 | * @param string|null $par A group to list users from |
| 56 | */ |
| 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 | |
| 95 | /** |
| 96 | * Return an array of subpages that this special page will accept. |
| 97 | * |
| 98 | * @return string[] subpages |
| 99 | */ |
| 100 | public function getSubpagesForPrefixSearch() { |
| 101 | return $this->userGroupManager->listAllGroups(); |
| 102 | } |
| 103 | |
| 104 | /** @inheritDoc */ |
| 105 | protected function getGroupName() { |
| 106 | return 'users'; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /** @deprecated class alias since 1.41 */ |
| 111 | class_alias( SpecialListUsers::class, 'SpecialListUsers' ); |