Merge "docs: Fix typo"
[mediawiki.git] / includes / specials / SpecialCategories.php
blob55cbe89aaefc5cf30e3282f1d2ebee025d75ba31
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.
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.
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
18 * @file
21 namespace MediaWiki\Specials;
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;
29 /**
30 * Implements Special:Categories
32 * @ingroup SpecialPage
34 class SpecialCategories extends SpecialPage {
36 private LinkBatchFactory $linkBatchFactory;
37 private IConnectionProvider $dbProvider;
39 public function __construct(
40 LinkBatchFactory $linkBatchFactory,
41 IConnectionProvider $dbProvider
42 ) {
43 parent::__construct( 'Categories' );
44 $this->linkBatchFactory = $linkBatchFactory;
45 $this->dbProvider = $dbProvider;
48 public function execute( $par ) {
49 $this->setHeaders();
50 $this->outputHeader();
51 $this->addHelpLink( 'Help:Categories' );
52 $this->getOutput()->getMetadata()->setPreventClickjacking( false );
54 $from = $this->getRequest()->getText( 'from', $par ?? '' );
56 $cap = new CategoryPager(
57 $this->getContext(),
58 $this->linkBatchFactory,
59 $this->getLinkRenderer(),
60 $this->dbProvider,
61 $from
63 $cap->doQuery();
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' )
76 protected function getGroupName() {
77 return 'pages';
81 /** @deprecated class alias since 1.41 */
82 class_alias( SpecialCategories::class, 'SpecialCategories' );