MediaWiki master
SpecialCategories.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Specials;
25
31
36
37 private LinkBatchFactory $linkBatchFactory;
38 private IConnectionProvider $dbProvider;
39
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
87class_alias( SpecialCategories::class, 'SpecialCategories' );
This class is a collection of static functions that serve two purposes:
Definition Html.php:56
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
execute( $par)
Default execute method Checks user permissions.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
__construct(LinkBatchFactory $linkBatchFactory, IConnectionProvider $dbProvider)
Provide primary and replica IDatabase connections.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...