MediaWiki REL1_28
Go to the documentation of this file.
29 public function __construct() {
30 parent::__construct( 'Categories' );
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 }
37 public function execute( $par ) {
38 $this->setHeaders();
39 $this->outputHeader();
40 $this->getOutput()->allowClickjacking();
42 $from = $this->getRequest()->getText( 'from', $par );
44 $cap = new CategoryPager(
45 $this->getContext(),
46 $from,
47 $this->getLinkRenderer()
48 );
49 $cap->doQuery();
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 }
62 protected function getGroupName() {
63 return 'pages';
64 }
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.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Sets headers - this should be called from the execute() method of all derived classes!
Get the OutputPage being used for this instance.
Gets the context this SpecialPage is executed in.
Get the WebRequest being used for this instance.
Wrapper around wfMessage that sets the current context.
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:37