22 $this->interfaceTitle = Title::newFromText(
"Special:PageDataRequestHandlerTest" );
24 $this->obLevel = ob_get_level();
30 while ( ob_get_level() > $this->obLevel ) {
35 $this->fail(
"Test changed output buffer level: was {$this->obLevel}" .
36 "before test, but $obLevel after test."
59 $request->response()->header(
'Status: 200 OK',
true, 200 );
70 $output->setTitle( $this->interfaceTitle );
79 $cases[] = [
'', [], [],
'!!', 400 ];
81 $cases[] = [
'', [
'target' =>
'Helsinki' ], [],
'!!', 303, [
'Location' =>
'!.+!' ] ];
84 foreach ( $cases
as $c ) {
88 if ( isset( $case[1][
'target'] ) ) {
89 $case[0] .= $case[1][
'target'];
90 unset( $case[1][
'target'] );
93 $subpageCases[] = $case;
96 $cases = array_merge( $cases, $subpageCases );
100 [
'target' =>
'Helsinki' ],
101 [
'Accept' =>
'text/HTML' ],
104 [
'Location' =>
'!Helsinki$!' ]
110 'target' =>
'Helsinki',
111 'revision' =>
'4242',
113 [
'Accept' =>
'text/HTML' ],
116 [
'Location' =>
'!Helsinki(\?|&)oldid=4242!' ]
125 [
'Location' =>
'!Helsinki&action=raw!' ]
132 [
'Accept' =>
'text/foobar' ],
141 [
'Accept' =>
'text/HTML' ],
144 [
'Location' =>
'!Helsinki$!' ]
150 [
'Accept' =>
'text/HTML' ],
153 [
'Location' =>
'!Helsinki$!' ]
159 [
'Accept' =>
'text/HTML' ],
162 [
'Location' =>
'!AC/DC$!' ]
183 $expectedStatusCode = 200,
184 array $expectedHeaders = []
199 if (
$output->getRedirect() !==
'' ) {
204 $text = ob_get_contents();
207 $this->assertEquals( $expectedStatusCode,
$response->getStatusCode(),
'status code' );
208 $this->assertRegExp( $expectedOutput, $text,
'output' );
210 foreach ( $expectedHeaders
as $name => $exp ) {
212 $this->assertNotNull(
$value,
"header: $name" );
213 $this->assertInternalType(
'string',
$value,
"header: $name" );
214 $this->assertRegExp( $exp,
$value,
"header: $name" );
218 $this->assertEquals( $expectedStatusCode,
$e->getStatusCode(),
'status code' );
219 $this->assertRegExp( $expectedOutput,
$e->getHTML(),
'error output' );
223 $this->assertSame(
'*',
$response->getHeader(
'Access-Control-Allow-Origin' ) );
227 $helsinki = Title::newFromText(
'Helsinki' );
229 'Accept Header of HTML' => [
231 [
'ACCEPT' =>
'text/html' ],
234 'Accept Header without weights' => [
236 [
'ACCEPT' =>
'*/*, text/html, text/x-wiki' ],
237 'Helsinki&action=raw'
239 'Accept Header with weights' => [
241 [
'ACCEPT' =>
'text/*; q=0.5, text/json; q=0.7, application/rdf+xml; q=0.8' ],
242 'Helsinki&action=raw'
244 'Accept Header accepting evertyhing and HTML' => [
246 [
'ACCEPT' =>
'text/html, */*' ],
247 'Helsinki&action=raw'
249 'No Accept Header' => [
252 'Helsinki&action=raw'
269 $expectedRedirectSuffix
278 $this->assertStringEndsWith(
279 $expectedRedirectSuffix,
An IContextSource implementation which will inherit context from another source but allow individual ...
WebRequest clone which takes values from a provided array.
Show an error that looks like an HTTP server error.
This class should be covered by a general architecture document which does not exist as of January 20...
PageDataRequestHandler PageData.
makeOutputPage(array $params, array $headers)
provideHttpContentNegotiation()
testHandleRequest( $subpage, array $params, array $headers, $expectedOutput, $expectedStatusCode=200, array $expectedHeaders=[])
handleRequestProvider
testHttpContentNegotiation(Title $title, array $headers, $expectedRedirectSuffix)
provideHttpContentNegotiation
Request handler implementing a data interface for mediawiki pages.
Represents a title within MediaWiki.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Allows to change the fields on the form that will be generated $name
this hook is for auditing only $response
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
returning false will NOT prevent logging $e
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))