48 if ( $subPage ===
'' || $subPage ===
null ) {
49 return $request->
getText(
'target' ) !==
'';
52 $parts = explode(
'/', $subPage, 2 );
55 return ( $slot === SlotRecord::MAIN || $slot ===
'' ) &&
$title !==
'';
75 $output->
getRequest()->response()->header(
'Access-Control-Allow-Origin: *' );
83 if ( $subPage !==
'' ) {
84 $parts = explode(
'/', $subPage, 2 );
90 $revision = $request->
getInt(
'oldid', $revision );
91 $revision = $request->
getInt(
'revision', $revision );
125 $mimeTypes = MediaWikiServices::getInstance()
126 ->getContentHandlerFactory()
127 ->getContentHandler(
$title->getContentModel() )
128 ->getSupportedFormats();
130 $acceptHeader = $request->
getHeader(
'Accept' );
131 if ( $acceptHeader !==
false ) {
133 $accept = $parser->parseWeights( $acceptHeader );
140 $accept[$mimeTypes[0]] = 1;
144 $format = $negotiator->getBestSupportedKey( $accept );
146 if ( $format ===
null ) {
147 $format = isset( $accept[
'text/html'] ) ?
'text/html' :
null;
150 if ( $format ===
null ) {
151 throw new HttpError( 406,
wfMessage(
'pagedata-not-acceptable', implode(
', ', $mimeTypes ) ) );
154 $url = $this->getDocUrl(
$title, $format, $revision );
166 private function getDocUrl(
Title $title, $format =
'', $revision = 0 ) {
169 if ( $revision > 0 ) {
170 $params[
'oldid'] = $revision;
173 if ( $format ===
'text/html' ) {
174 return $title->getFullURL( $params );
177 $params[
'action' ] =
'raw';
179 return $title->getFullURL( $params );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Show an error that looks like an HTTP server error.
This is one of the Core classes and should be read at least once by any new developers.
redirect( $url, $responsecode='302')
Redirect to $url rather than displaying the normal page.
Request handler implementing a data interface for mediawiki pages.
canHandleRequest( $subPage, WebRequest $request)
Checks whether the request is complete, i.e.
handleRequest( $subPage, WebRequest $request, OutputPage $output)
Main method for handling requests.
httpContentNegotiation(WebRequest $request, OutputPage $output, Title $title, $revision=0)
Applies HTTP content negotiation.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
getInt( $name, $default=0)
Fetch an integer value from the input or return $default if not set.
getText( $name, $default='')
Fetch a text string and return it in normalized form.
getHeader( $name, $flags=0)
Get a request header, or false if it isn't set.