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 | /** |
40 | * @param LinkBatchFactory $linkBatchFactory |
41 | * @param IConnectionProvider $dbProvider |
42 | */ |
43 | public function __construct( |
44 | LinkBatchFactory $linkBatchFactory, |
45 | IConnectionProvider $dbProvider |
46 | ) { |
47 | parent::__construct( 'Categories' ); |
48 | $this->linkBatchFactory = $linkBatchFactory; |
49 | $this->dbProvider = $dbProvider; |
50 | } |
51 | |
52 | public function execute( $par ) { |
53 | $this->setHeaders(); |
54 | $this->outputHeader(); |
55 | $this->addHelpLink( 'Help:Categories' ); |
56 | $this->getOutput()->getMetadata()->setPreventClickjacking( false ); |
57 | |
58 | $from = $this->getRequest()->getText( 'from', $par ?? '' ); |
59 | |
60 | $cap = new CategoryPager( |
61 | $this->getContext(), |
62 | $this->linkBatchFactory, |
63 | $this->getLinkRenderer(), |
64 | $this->dbProvider, |
65 | $from |
66 | ); |
67 | $cap->doQuery(); |
68 | |
69 | $this->getOutput()->addHTML( |
70 | Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) . |
71 | $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() . |
72 | $cap->getStartForm( $from ) . |
73 | $cap->getNavigationBar() . |
74 | '<ul>' . $cap->getBody() . '</ul>' . |
75 | $cap->getNavigationBar() . |
76 | Html::closeElement( 'div' ) |
77 | ); |
78 | } |
79 | |
80 | protected function getGroupName() { |
81 | return 'pages'; |
82 | } |
83 | } |
84 | |
85 | /** @deprecated class alias since 1.41 */ |
86 | class_alias( SpecialCategories::class, 'SpecialCategories' ); |