MediaWiki REL1_30
SpecialPageData.php
Go to the documentation of this file.
1<?php
2
11
15 private $requestHandler = null;
16
17 public function __construct() {
18 parent::__construct( 'PageData' );
19 }
20
32 $this->requestHandler = $requestHandler;
33 }
34
39 protected function initDependencies() {
40 if ( $this->requestHandler === null ) {
41 $this->requestHandler = $this->newDefaultRequestHandler();
42 }
43 }
44
50 private function newDefaultRequestHandler() {
51 return new PageDataRequestHandler();
52 }
53
61 public function execute( $subPage ) {
62 $this->initDependencies();
63
64 // If there is no title, show an HTML form
65 // TODO: Don't do this if HTML is not acceptable according to HTTP headers.
66 if ( !$this->requestHandler->canHandleRequest( $subPage, $this->getRequest() ) ) {
67 $this->showForm();
68 return;
69 }
70
71 $this->requestHandler->handleRequest( $subPage, $this->getRequest(), $this->getOutput() );
72 }
73
77 public function showForm() {
78 $this->getOutput()->showErrorPage( 'pagedata-title', 'pagedata-text' );
79 }
80
81 public function isListed() {
82 // Do not list this page in Special:SpecialPages
83 return false;
84 }
85
86}
Request handler implementing a data interface for mediawiki pages.
Special page to act as an endpoint for accessing raw page data.
initDependencies()
Initialize any un-initialized members from global context.
PageDataRequestHandler null $requestHandler
newDefaultRequestHandler()
Creates a PageDataRequestHandler based on global defaults.
showForm()
Shows an informative page to the user; Called when there is no page to output.
isListed()
Whether this special page is listed in Special:SpecialPages.
setRequestHandler(PageDataRequestHandler $requestHandler)
Sets the request handler to be used by the special page.
Parent class for all special pages.
getOutput()
Get the OutputPage being used for this instance.
getRequest()
Get the WebRequest being used for this instance.