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