MediaWiki  master
SpecialCategories.php
Go to the documentation of this file.
1 <?php
26 
31 
33  private $linkBatchFactory;
34 
36  private $loadBalancer;
37 
42  public function __construct(
43  LinkBatchFactory $linkBatchFactory,
44  ILoadBalancer $loadBalancer
45  ) {
46  parent::__construct( 'Categories' );
47  $this->linkBatchFactory = $linkBatchFactory;
48  $this->loadBalancer = $loadBalancer;
49  }
50 
51  public function execute( $par ) {
52  $this->setHeaders();
53  $this->outputHeader();
54  $this->addHelpLink( 'Help:Categories' );
55  $this->getOutput()->setPreventClickjacking( false );
56 
57  $from = $this->getRequest()->getText( 'from', $par ?? '' );
58 
59  $cap = new CategoryPager(
60  $this->getContext(),
61  $this->linkBatchFactory,
62  $this->getLinkRenderer(),
63  $this->loadBalancer,
64  $from
65  );
66  $cap->doQuery();
67 
68  $this->getOutput()->addHTML(
69  Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) .
70  $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() .
71  $cap->getStartForm( $from ) .
72  $cap->getNavigationBar() .
73  '<ul>' . $cap->getBody() . '</ul>' .
74  $cap->getNavigationBar() .
75  Html::closeElement( 'div' )
76  );
77  }
78 
79  protected function getGroupName() {
80  return 'pages';
81  }
82 }
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:256
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:320
__construct(LinkBatchFactory $linkBatchFactory, ILoadBalancer $loadBalancer)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
Default execute method Checks user permissions.
Parent class for all special pages.
Definition: SpecialPage.php:44
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
This class is a delegate to ILBFactory for a given database cluster.