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 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace MediaWiki\Specials; |
22 | |
23 | use MediaWiki\Cache\LinkBatchFactory; |
24 | use MediaWiki\Html\Html; |
25 | use MediaWiki\Pager\CategoryPager; |
26 | use MediaWiki\SpecialPage\SpecialPage; |
27 | use Wikimedia\Rdbms\IConnectionProvider; |
28 | |
29 | /** |
30 | * Implements Special:Categories |
31 | * |
32 | * @ingroup SpecialPage |
33 | */ |
34 | class SpecialCategories extends SpecialPage { |
35 | |
36 | private LinkBatchFactory $linkBatchFactory; |
37 | private IConnectionProvider $dbProvider; |
38 | |
39 | public function __construct( |
40 | LinkBatchFactory $linkBatchFactory, |
41 | IConnectionProvider $dbProvider |
42 | ) { |
43 | parent::__construct( 'Categories' ); |
44 | $this->linkBatchFactory = $linkBatchFactory; |
45 | $this->dbProvider = $dbProvider; |
46 | } |
47 | |
48 | public function execute( $par ) { |
49 | $this->setHeaders(); |
50 | $this->outputHeader(); |
51 | $this->addHelpLink( 'Help:Categories' ); |
52 | $this->getOutput()->getMetadata()->setPreventClickjacking( false ); |
53 | |
54 | $from = $this->getRequest()->getText( 'from', $par ?? '' ); |
55 | |
56 | $cap = new CategoryPager( |
57 | $this->getContext(), |
58 | $this->linkBatchFactory, |
59 | $this->getLinkRenderer(), |
60 | $this->dbProvider, |
61 | $from |
62 | ); |
63 | $cap->doQuery(); |
64 | |
65 | $this->getOutput()->addHTML( |
66 | Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) . |
67 | $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() . |
68 | $cap->getStartForm( $from ) . |
69 | $cap->getNavigationBar() . |
70 | '<ul>' . $cap->getBody() . '</ul>' . |
71 | $cap->getNavigationBar() . |
72 | Html::closeElement( 'div' ) |
73 | ); |
74 | } |
75 | |
76 | protected function getGroupName() { |
77 | return 'pages'; |
78 | } |
79 | } |
80 | |
81 | /** @deprecated class alias since 1.41 */ |
82 | class_alias( SpecialCategories::class, 'SpecialCategories' ); |