Go to the documentation of this file.
25 'emptyObject' =>
new stdClass,
27 'string' =>
'foobar\\',
34 '"7":["8",{"9":"10"}]',
36 "{\n\t\"emptyObject\": {\n\t},\n\t\"emptyArray\": [ ]\n}",
44 "string": "foobar\\\\",
50 "\"7\":[\"8\",{\"9\":\"10\"}]",
51 "{\n\t\"emptyObject\": {\n\t},\n\t\"emptyArray\": [ ]\n}"
55 $json = str_replace(
"\r",
'', $json );
56 $json = str_replace(
"\t", $expectedIndent, $json );
105 $this->assertNotEquals(
108 'Test encoding an broken json_encode character (U+20000)'
113 $this->assertInternalType(
119 $this->assertInternalType(
139 [ [
'a' =>
'b',
'x' => [
'c' =>
'd' ] ] ],
159 $this->assertJson( $json );
163 $this->assertTrue( $st->isGood() );
164 $this->assertEquals( $expected, $st->getValue() );
168 $this->assertTrue( $st->isGood() );
169 $this->assertEquals(
$value, $st->getValue() );
192 [
"[,]",
'[]',
false ],
193 [
"[ , ]",
'[]',
false ],
195 [
'[1],',
false,
true,
'[1]' ],
200 [
"[1\n,\n]\n",
'[1]' ],
201 [
'["a,",]',
'["a,"]' ],
202 [
"[[1,]\n,[2,\n],[3\n,]]",
'[[1],[2],[3]]' ],
204 [
'[[1,],[2,],[3,]]',
false,
true,
'[[1],[2],[3]]' ],
205 [
'[1,,]',
false,
false,
'[1]' ],
219 $jsoncParses =
true, $expectedJsonc =
null
222 $expectedGoodStatus =
false;
225 if ( json_decode(
'[1,]' ) !==
null ) {
227 $expected = ( $expectedJsonc === null ) ? $expected : $expectedJsonc;
229 $expectedGoodStatus = $jsoncParses;
234 if ( $expected ===
false ) {
235 $this->assertFalse( $st->isOK(),
'Expected isOK() == false' );
237 $this->assertSame( $expectedGoodStatus, $st->isGood(),
238 'Expected isGood() == ' . ( $expectedGoodStatus ?
'true' :
'false' )
240 $this->assertTrue( $st->isOK(),
'Expected isOK == true' );
242 $this->assertEquals( $expected, $val );
260 $this->assertFalse( $st->isOK() );
265 [
'{"a":"b"}',
'{"a":"b"}' ],
266 [
"{\"a\":\"b\"}\n",
"{\"a\":\"b\"}\n" ],
267 [
'/*c*/{"c":"b"}',
'{"c":"b"}' ],
268 [
'{"a":"c"}/*c*/',
'{"a":"c"}' ],
269 [
'/*c//d*/{"c":"b"}',
'{"c":"b"}' ],
270 [
'{/*c*/"c":"b"}',
'{"c":"b"}' ],
271 [
"/*\nc\r\n*/{\"c\":\"b\"}",
'{"c":"b"}' ],
272 [
"//c\n{\"c\":\"b\"}",
'{"c":"b"}' ],
273 [
"//c\r\n{\"c\":\"b\"}",
'{"c":"b"}' ],
274 [
'{"a":"c"}//c',
'{"a":"c"}' ],
275 [
"{\"a-c\"://c\n\"b\"}",
'{"a-c":"b"}' ],
276 [
'{"/*a":"b"}',
'{"/*a":"b"}' ],
277 [
'{"a":"//b"}',
'{"a":"//b"}' ],
278 [
'{"a":"b/*c*/"}',
'{"a":"b/*c*/"}' ],
279 [
"{\"\\\"/*a\":\"b\"}",
"{\"\\\"/*a\":\"b\"}" ],
283 [
'"http://example.com"',
'"http://example.com"' ],
285 [
'"Blåbærsyltetøy"',
'"Blåbærsyltetøy"' ],
301 [
'/* blah */true',
true ],
302 [
"// blah \ntrue",
true ],
303 [
'[ "a" , /* blah */ "b" ]', [
'a',
'b' ] ],
317 $this->assertTrue( $st->isGood() );
318 $this->assertEquals( $expect, $st->getValue() );
347 '\\\\' =>
'\\\\\\\\',
348 '\\u00e9' =>
'\\\u00e9',
351 "\xe2\x80\xa8" =>
'\u2028',
352 "\xe2\x80\xa9" =>
'\u2029',
355 "\xc3\xa9" =>
'\u00e9',
356 "\xf0\x9d\x92\x9e" =>
'\ud835\udc9e',
366 foreach ( $groups
as $name => $rules ) {
367 $leaveUnescaped = in_array(
$name, $unescapedGroups );
368 foreach ( $rules
as $from => $to ) {
369 $cases[] = [ $from,
'"' . ( $leaveUnescaped ? $from : $to ) .
'"' ];
processing should stop and the error should be shown to the user * false
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))
Allows to change the fields on the form that will be generated $name
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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object