MediaWiki  1.34.0
SpecialPageData.php
Go to the documentation of this file.
1 <?php
31 
35  private $requestHandler = null;
36 
37  public function __construct() {
38  parent::__construct( 'PageData' );
39  }
40 
52  $this->requestHandler = $requestHandler;
53  }
54 
59  protected function initDependencies() {
60  if ( $this->requestHandler === null ) {
61  $this->requestHandler = $this->newDefaultRequestHandler();
62  }
63  }
64 
70  private function newDefaultRequestHandler() {
71  return new PageDataRequestHandler();
72  }
73 
81  public function execute( $subPage ) {
82  $this->initDependencies();
83 
84  // If there is no title, show an HTML form
85  // TODO: Don't do this if HTML is not acceptable according to HTTP headers.
86  if ( !$this->requestHandler->canHandleRequest( $subPage, $this->getRequest() ) ) {
87  $this->showForm();
88  return;
89  }
90 
91  $this->requestHandler->handleRequest( $subPage, $this->getRequest(), $this->getOutput() );
92  }
93 
97  public function showForm() {
98  $this->getOutput()->showErrorPage( 'pagedata-title', 'pagedata-text' );
99  }
100 
101  public function isListed() {
102  // Do not list this page in Special:SpecialPages
103  return false;
104  }
105 
106 }
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:719
PageDataRequestHandler
Request handler implementing a data interface for mediawiki pages.
Definition: PageDataRequestHandler.php:30
SpecialPageData\newDefaultRequestHandler
newDefaultRequestHandler()
Creates a PageDataRequestHandler based on global defaults.
Definition: SpecialPageData.php:70
SpecialPageData\setRequestHandler
setRequestHandler(PageDataRequestHandler $requestHandler)
Sets the request handler to be used by the special page.
Definition: SpecialPageData.php:51
SpecialPageData\__construct
__construct()
Definition: SpecialPageData.php:37
SpecialPageData
Special page to act as an endpoint for accessing raw page data.
Definition: SpecialPageData.php:30
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:37
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:709
SpecialPageData\showForm
showForm()
Shows an informative page to the user; Called when there is no page to output.
Definition: SpecialPageData.php:97
SpecialPageData\isListed
isListed()
Whether this special page is listed in Special:SpecialPages.
Definition: SpecialPageData.php:101
SpecialPageData\$requestHandler
PageDataRequestHandler null $requestHandler
Definition: SpecialPageData.php:35
SpecialPageData\execute
execute( $subPage)
Definition: SpecialPageData.php:81
SpecialPageData\initDependencies
initDependencies()
Initialize any un-initialized members from global context.
Definition: SpecialPageData.php:59