Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 27 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| SpecialCategories | |
0.00% |
0 / 26 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
2 | |||
| getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * @license GPL-2.0-or-later |
| 4 | * @file |
| 5 | */ |
| 6 | |
| 7 | namespace MediaWiki\Specials; |
| 8 | |
| 9 | use MediaWiki\Html\Html; |
| 10 | use MediaWiki\Page\LinkBatchFactory; |
| 11 | use MediaWiki\Pager\CategoryPager; |
| 12 | use MediaWiki\SpecialPage\SpecialPage; |
| 13 | use Wikimedia\Rdbms\IConnectionProvider; |
| 14 | |
| 15 | /** |
| 16 | * Implements Special:Categories |
| 17 | * |
| 18 | * @ingroup SpecialPage |
| 19 | */ |
| 20 | class SpecialCategories extends SpecialPage { |
| 21 | |
| 22 | private LinkBatchFactory $linkBatchFactory; |
| 23 | private IConnectionProvider $dbProvider; |
| 24 | |
| 25 | public function __construct( |
| 26 | LinkBatchFactory $linkBatchFactory, |
| 27 | IConnectionProvider $dbProvider |
| 28 | ) { |
| 29 | parent::__construct( 'Categories' ); |
| 30 | $this->linkBatchFactory = $linkBatchFactory; |
| 31 | $this->dbProvider = $dbProvider; |
| 32 | } |
| 33 | |
| 34 | /** @inheritDoc */ |
| 35 | public function execute( $par ) { |
| 36 | $this->setHeaders(); |
| 37 | $this->outputHeader(); |
| 38 | $this->addHelpLink( 'Help:Categories' ); |
| 39 | $this->getOutput()->getMetadata()->setPreventClickjacking( false ); |
| 40 | |
| 41 | $from = $this->getRequest()->getText( 'from', $par ?? '' ); |
| 42 | |
| 43 | $cap = new CategoryPager( |
| 44 | $this->getContext(), |
| 45 | $this->linkBatchFactory, |
| 46 | $this->getLinkRenderer(), |
| 47 | $this->dbProvider, |
| 48 | $from |
| 49 | ); |
| 50 | $cap->doQuery(); |
| 51 | |
| 52 | $this->getOutput()->addHTML( |
| 53 | Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) . |
| 54 | $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() . |
| 55 | $cap->getStartForm( $from ) . |
| 56 | $cap->getNavigationBar() . |
| 57 | '<ul>' . $cap->getBody() . '</ul>' . |
| 58 | $cap->getNavigationBar() . |
| 59 | Html::closeElement( 'div' ) |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | /** @inheritDoc */ |
| 64 | protected function getGroupName() { |
| 65 | return 'pages'; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /** @deprecated class alias since 1.41 */ |
| 70 | class_alias( SpecialCategories::class, 'SpecialCategories' ); |