MediaWiki  master
SpecialCategories.php
Go to the documentation of this file.
1 <?php
28 
29  public function __construct() {
30  parent::__construct( 'Categories' );
31 
32  // Since we don't control the constructor parameters, we can't inject services that way.
33  // Instead, we initialize services in the execute() method, and allow them to be overridden
34  // using the initServices() method.
35  }
36 
37  public function execute( $par ) {
38  $this->setHeaders();
39  $this->outputHeader();
40  $this->getOutput()->allowClickjacking();
41 
42  $from = $this->getRequest()->getText( 'from', $par );
43 
44  $cap = new CategoryPager(
45  $this->getContext(),
46  $from,
47  $this->getLinkRenderer()
48  );
49  $cap->doQuery();
50 
51  $this->getOutput()->addHTML(
52  Html::openElement( 'div', [ 'class' => 'mw-spcontent' ] ) .
53  $this->msg( 'categoriespagetext', $cap->getNumRows() )->parseAsBlock() .
54  $cap->getStartForm( $from ) .
55  $cap->getNavigationBar() .
56  '<ul>' . $cap->getBody() . '</ul>' .
57  $cap->getNavigationBar() .
58  Html::closeElement( 'div' )
59  );
60  }
61 
62  protected function getGroupName() {
63  return 'pages';
64  }
65 }
getContext()
Gets the context this SpecialPage is executed in.
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing &#39;/&#39;...
Definition: Html.php:252
getOutput()
Get the OutputPage being used for this instance.
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:310
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
msg( $key)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest 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...