3use Wikimedia\TestingAccessWrapper;
7 protected function setUp() {
11 'wgShowExceptionDetails' =>
true,
21 $resourceLoaderRegisterModulesHook =
false;
24 'ResourceLoaderRegisterModules' => [
26 $resourceLoaderRegisterModulesHook =
true;
33 $resourceLoaderRegisterModulesHook,
34 'Hook ResourceLoaderRegisterModules called'
77 $this->setExpectedException( MWException::class,
"name 'test!invalid' is invalid" );
86 $this->setExpectedException( MWException::class,
'ResourceLoader module info type error' );
94 $logger = $this->getMockBuilder( Psr\Log\LoggerInterface::class )->getMock();
95 $logger->expects( $this->once() )
96 ->method(
'warning' );
115 [
'test.foo',
'test.bar' ],
121 $fileModuleObj = $this->getMockBuilder( ResourceLoaderFileModule::class )
122 ->disableOriginalConstructor()
128 'FileModule object' => [
false,
131 'simple empty' => [
true,
134 'simple scripts' => [
true,
135 [
'scripts' =>
'example.js' ]
137 'simple scripts, raw and targets' => [
true, [
138 'scripts' => [
'a.js',
'b.js' ],
140 'targets' => [
'desktop',
'mobile' ],
142 'FileModule' => [
true,
143 [
'class' => ResourceLoaderFileModule::class,
'scripts' =>
'example.js' ]
145 'TestModule' => [
false,
146 [
'class' => ResourceLoaderTestModule::class,
'scripts' =>
'example.js' ]
148 'SkinModule (FileModule subclass)' => [
true,
149 [
'class' => ResourceLoaderSkinModule::class,
'scripts' =>
'example.js' ]
151 'JqueryMsgModule (FileModule subclass)' => [
true, [
152 'class' => ResourceLoaderJqueryMsgModule::class,
153 'scripts' =>
'example.js',
155 'WikiModule' => [
false, [
156 'class' => ResourceLoaderWikiModule::class,
157 'scripts' => [
'MediaWiki:Example.js' ],
168 $rl->register(
'test', $module );
169 $this->assertSame( $expected, $rl->isFileModule(
'test' ) );
177 $this->assertSame(
false, $rl->isFileModule(
'unknown' ) );
186 $this->assertTrue( $rl->isModuleRegistered(
'test' ) );
187 $this->assertFalse( $rl->isModuleRegistered(
'test.unknown' ) );
195 $this->assertSame(
null, $rl->getModule(
'test' ) );
203 $rl->register(
'test', [
'class' => ResourceLoaderTestModule::class ] );
204 $this->assertInstanceOf(
205 ResourceLoaderTestModule::class,
206 $rl->getModule(
'test' )
214 $factory =
function (
array $info ) {
215 $this->assertArrayHasKey(
'kitten', $info );
220 $rl->register(
'test', [
'factory' => $factory,
'kitten' =>
'little ball of fur' ] );
221 $this->assertInstanceOf(
222 ResourceLoaderTestModule::class,
223 $rl->getModule(
'test' )
232 $rl->register(
'test', [] );
233 $this->assertInstanceOf(
234 ResourceLoaderFileModule::class,
235 $rl->getModule(
'test' ),
236 'Array-style module registrations default to FileModule'
245 $lc = $rl->getLessCompiler( [
'foo' =>
'2px',
'Foo' =>
'#eeeeee' ] );
246 $basePath = dirname( dirname( __DIR__ ) ) .
'/data/less';
247 $lc->SetImportDirs( [
248 "$basePath/common" =>
'',
250 $css = $lc->parseFile(
"$basePath/module/use-import-dir.less" )->getCss();
251 $this->assertStringEqualsFile(
"$basePath/module/styles.css",
$css );
257 'Example from makePackedModulesString doc comment',
258 [
'foo.bar',
'foo.baz',
'bar.baz',
'bar.quux' ],
259 'foo.bar,baz|bar.baz,quux',
262 'Example from expandModuleNames doc comment',
263 [
'jquery.foo',
'jquery.bar',
'jquery.ui.baz',
'jquery.ui.quux' ],
264 'jquery.foo,bar|jquery.ui.baz,quux',
267 'Regression fixed in r87497 (7fee86c38e) with dotless names',
268 [
'foo',
'bar',
'baz' ],
272 'Prefixless modules after a prefixed module',
273 [
'single.module',
'foobar',
'foobaz' ],
274 'single.module|foobar,foobaz',
278 [
'foo',
'foo.baz',
'baz.quux',
'foo.bar' ],
279 'foo|foo.baz,bar|baz.quux',
280 [
'foo',
'foo.baz',
'foo.bar',
'baz.quux' ],
307 [
'foowiki',
'https://example.org/w/load.php',
'foowiki' ],
308 [
'foowiki', [
'loadScript' =>
'https://example.org/w/load.php' ],
'foowiki' ],
311 'foowiki' =>
'https://example.org/w/load.php',
312 'bazwiki' =>
'https://example.com/w/load.php',
315 [
'foowiki',
'bazwiki' ]
328 if ( is_array( $expected ) ) {
330 $this->assertArrayHasKey(
$source, $rl->getSources() );
333 $this->assertArrayHasKey( $expected, $rl->getSources() );
342 $this->setExpectedException(
343 MWException::class,
'ResourceLoader duplicate source addition error'
345 $rl->addSource(
'foo',
'https://example.org/w/load.php' );
346 $rl->addSource(
'foo',
'https://example.com/w/load.php' );
354 $this->setExpectedException( MWException::class,
'with no "loadScript" key' );
355 $rl->addSource(
'foo', [
'x' =>
'https://example.org/w/load.php' ] );
361 'title' =>
'Implement scripts, styles and messages',
363 'name' =>
'test.example',
364 'scripts' =>
'mw.example();',
365 'styles' => [
'css' => [
'.mw-example {}' ] ],
366 'messages' => [
'example' =>
'' ],
369 'expected' =>
'mw.loader.implement( "test.example", function ( $, jQuery, require, module ) {
380 'title' =>
'Implement scripts',
382 'name' =>
'test.example',
383 'scripts' =>
'mw.example();',
386 'expected' =>
'mw.loader.implement( "test.example", function ( $, jQuery, require, module ) {
391 'title' =>
'Implement styles',
393 'name' =>
'test.example',
395 'styles' => [
'css' => [
'.mw-example {}' ] ],
397 'expected' =>
'mw.loader.implement( "test.example", [], {
404 'title' =>
'Implement scripts and messages',
406 'name' =>
'test.example',
407 'scripts' =>
'mw.example();',
408 'messages' => [
'example' =>
'' ],
410 'expected' =>
'mw.loader.implement( "test.example", function ( $, jQuery, require, module ) {
417 'title' =>
'Implement scripts and templates',
419 'name' =>
'test.example',
420 'scripts' =>
'mw.example();',
421 'templates' => [
'example.html' =>
'' ],
423 'expected' =>
'mw.loader.implement( "test.example", function ( $, jQuery, require, module ) {
430 'title' =>
'Implement unwrapped user script',
433 'scripts' =>
'mw.example( 1 );',
436 'expected' =>
'mw.loader.implement( "user", "mw.example( 1 );" );',
449 'styles' => [],
'templates' => [],
'messages' =>
new XmlJsCode(
'{}' )
454 $rl = TestingAccessWrapper::newFromClass( ResourceLoader::class );
457 $rl->makeLoaderImplementScript(
459 ( $case[
'wrap'] && is_string( $case[
'scripts'] ) )
473 $this->setExpectedException( MWException::class,
'Invalid scripts error' );
474 $rl = TestingAccessWrapper::newFromClass( ResourceLoader::class );
475 $rl->makeLoaderImplementScript(
489 'mw.loader.register( [
496 [
'test.name',
'1234567' ],
498 'Nested array parameter'
502 'mw.loader.register( [
532 [
'test.foo',
'100' , [],
null,
null ],
533 [
'test.bar',
'200', [
'test.unknown' ],
null ],
534 [
'test.baz',
'300', [
'test.quux',
'test.foo' ],
null ],
535 [
'test.quux',
'400', [],
null,
null,
'return true;' ],
537 'Compact dependency indexes'
546 'mw.loader.addSource( {
547 "local": "/w/load.php"
552 'mw.loader.addSource( {
553 "local": "/w/load.php"
558 'mw.loader.addSource( {
559 "local": "/w/load.php",
560 "example": "https://example.org/w/load.php"
563 'local' =>
'/w/load.php',
564 'example' =>
'https://example.org/w/load.php'
568 'mw.loader.addSource( [] );',
576 'loadScript' =>
'//example.org/w/load.php',
577 'apiScript' =>
'//example.org/w/api.php',
580 'loadScript' =>
'//example.com/w/load.php',
581 'apiScript' =>
'//example.com/w/api.php',
593 $rl->addSource( $sources );
594 foreach ( [
'examplewiki',
'example2wiki' ]
as $name ) {
595 $this->assertEquals( $rl->getLoadScript(
$name ), $sources[
$name][
'loadScript'] );
599 $rl->getLoadScript(
'thiswasneverreigstered' );
600 $this->assertTrue(
false,
'ResourceLoader::getLoadScript should have thrown an exception' );
602 $this->assertTrue(
true );
607 $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
608 ->setMethods( [ $getter ] )
610 $mock->method( $getter )->will( $this->throwException(
611 new Exception(
'Ferry not found' )
617 $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
618 ->setMethods( [
'getScript' ] )
620 $mock->method(
'getScript' )->willReturn( $script );
625 $mock = $this->getMockBuilder( ResourceLoaderTestModule::class )
626 ->setMethods( [
'getStyles' ] )
628 $mock->method(
'getStyles' )->willReturn( [
'' => $styles ] );
636 $rl = $this->getMockBuilder( EmptyResourceLoader::class )
638 ->setMethods( [
'outputErrorAndLog' ] )->getMock();
640 'foo' => self::getSimpleModuleMock(),
641 'ferry' => self::getFailFerryMock(),
642 'bar' => self::getSimpleModuleMock(),
648 $rl->getCombinedVersion(
$context, [] ),
654 $rl->getCombinedVersion(
$context, [
'foo' ] ),
662 $rl->getCombinedVersion(
$context, [
'foo',
'ferry',
'bar' ] ),
663 'compute foo+ferry+bar (T152266)'
673 'expected' =>
"foo()\n" .
'mw.loader.state( {
676 'minified' =>
"foo()\n" .
'mw.loader.state({"foo":"ready"});',
677 'message' =>
'Script without semi-colon',
684 'expected' =>
"foo()\nbar()\n" .
'mw.loader.state( {
688 'minified' =>
"foo()\nbar()\n" .
'mw.loader.state({"foo":"ready","bar":"ready"});',
689 'message' =>
'Two scripts without semi-colon',
693 'foo' =>
"foo()\n// bar();"
695 'expected' =>
"foo()\n// bar();\n" .
'mw.loader.state( {
698 'minified' =>
"foo()\n" .
'mw.loader.state({"foo":"ready"});',
699 'message' =>
'Script with semi-colon in comment (T162719)',
703 foreach ( $testcases
as $i => $case ) {
710 $ret[
"#$i (minified)"] = [
728 $modules = array_map(
function ( $script ) {
736 'modules' => implode(
'|', array_keys(
$modules ) ),
743 $this->assertSame( [], $rl->getErrors(),
'Errors' );
744 $this->assertEquals( $expected,
$response, $message ?:
'Response' );
753 [
'modules' =>
'',
'only' =>
'scripts' ],
758 $this->assertSame( [], $rl->getErrors(),
'Errors' );
759 $this->assertRegExp(
'/^\/\*.+no modules were requested.+\*\/$/ms',
$response );
779 'modules' =>
'foo|ferry|bar',
786 $this->
setLogger(
'exception',
new Psr\Log\NullLogger() );
789 $errors = $rl->getErrors();
791 $this->assertCount( 1, $errors );
792 $this->assertRegExp(
'/Ferry not found/', $errors[0] );
794 "foo();\nbar();\n" .
'mw.loader.state( {
819 'modules' =>
'foo|ferry|bar',
827 $this->
setLogger(
'exception',
new Psr\Log\NullLogger() );
830 $errors = $rl->getErrors();
832 $this->assertCount( 2, $errors );
833 $this->assertRegExp(
'/Ferry not found/', $errors[0] );
834 $this->assertRegExp(
'/Problem.+"ferry":\s*"error"/ms', $errors[1] );
850 'foo' => self::getSimpleModuleMock(
'foo();' ),
851 'ferry' => self::getFailFerryMock(),
852 'bar' => self::getSimpleModuleMock(
'bar();' ),
853 'startup' => [
'class' => ResourceLoaderStartUpModule::class ],
857 'modules' =>
'startup',
864 [
'foo',
'ferry',
'bar',
'startup' ],
865 $rl->getModuleNames(),
870 $this->
setLogger(
'exception',
new Psr\Log\NullLogger() );
872 $modules = [
'startup' => $rl->getModule(
'startup' ) ];
874 $errors = $rl->getErrors();
876 $this->assertRegExp(
'/Ferry not found/', $errors[0] );
877 $this->assertCount( 1, $errors );
879 '/isCompatible.*window\.RLQ/s',
881 'startup response undisrupted (T152266)'
884 '/register\([^)]+"ferry",\s*""/s',
886 'startup response registers broken module'
889 '/state\([^)]+"ferry":\s*"error"/s',
891 'startup response sets state to error'
903 $module = $this->getMockBuilder( ResourceLoaderTestModule::class )
904 ->setMethods( [
'getPreloadLinks' ] )->getMock();
905 $module->method(
'getPreloadLinks' )->willReturn( [
906 'https://example.org/script.js' => [
'as' =>
'script' ],
914 [
'modules' =>
'foo',
'only' =>
'scripts' ],
918 $modules = [
'foo' => $rl->getModule(
'foo' ) ];
920 $extraHeaders = TestingAccessWrapper::newFromObject( $rl )->extraHeaders;
924 'Link: <https://example.org/script.js>;rel=preload;as=script'
937 $foo = $this->getMockBuilder( ResourceLoaderTestModule::class )
938 ->setMethods( [
'getPreloadLinks' ] )->getMock();
939 $foo->method(
'getPreloadLinks' )->willReturn( [
940 'https://example.org/script.js' => [
'as' =>
'script' ],
943 $bar = $this->getMockBuilder( ResourceLoaderTestModule::class )
944 ->setMethods( [
'getPreloadLinks' ] )->getMock();
945 $bar->method(
'getPreloadLinks' )->willReturn( [
946 '/example.png' => [
'as' =>
'image' ],
947 '/example.jpg' => [
'as' =>
'image' ],
951 $rl->register( [
'foo' => $foo,
'bar' => $bar ] );
953 [
'modules' =>
'foo|bar',
'only' =>
'scripts' ],
957 $modules = [
'foo' => $rl->getModule(
'foo' ),
'bar' => $rl->getModule(
'bar' ) ];
959 $extraHeaders = TestingAccessWrapper::newFromObject( $rl )->extraHeaders;
962 'Link: <https://example.org/script.js>;rel=preload;as=script',
963 'Link: </example.png>;rel=preload;as=image,</example.jpg>;rel=preload;as=image'
974 $rl = $this->getMockBuilder( EmptyResourceLoader::class )
976 'tryRespondNotModified',
977 'sendResponseHeaders',
978 'measureResponseTime',
983 $rl->expects( $this->once() )->method(
'measureResponseTime' );
984 $this->expectOutputRegex(
'/no modules were requested/' );
994 $rl = $this->getMockBuilder( EmptyResourceLoader::class )
996 'measureResponseTime',
997 'tryRespondNotModified',
998 'sendResponseHeaders',
999 'makeModuleResponse',
1002 $rl->register(
'test', $module );
1004 [
'modules' =>
'test',
'only' =>
null ],
1008 $rl->expects( $this->once() )->method(
'makeModuleResponse' )
1009 ->with(
$context, [
'test' => $module ] )
1010 ->willReturn(
'implement_foo;' );
1011 $this->expectOutputRegex(
'/^implement_foo;/' );
1021 $rl = $this->getMockBuilder( EmptyResourceLoader::class )
1023 'measureResponseTime',
1024 'preloadModuleInfo',
1025 'getCombinedVersion',
1026 'tryRespondNotModified',
1027 'makeModuleResponse',
1028 'sendResponseHeaders',
1031 $rl->register(
'test', $module );
1034 $this->
setLogger(
'exception',
new Psr\Log\NullLogger() );
1036 $rl->expects( $this->once() )->method(
'preloadModuleInfo' )
1037 ->willThrowException(
new Exception(
'Preload error' ) );
1038 $rl->expects( $this->once() )->method(
'getCombinedVersion' )
1039 ->willThrowException(
new Exception(
'Version error' ) );
1040 $rl->expects( $this->once() )->method(
'makeModuleResponse' )
1041 ->with(
$context, [
'test' => $module ] )
1042 ->willReturn(
'foo;' );
1044 $this->expectOutputRegex(
'/^\/\*.+Preload error.+Version error.+\*\/.*foo;/ms' );
1053 $stats = $this->getMockBuilder( NullStatsdDataFactory::class )
1054 ->setMethods( [
'timing' ] )->getMock();
1055 $this->
setService(
'StatsdDataFactory', $stats );
1057 $stats->expects( $this->once() )->method(
'timing' )
1058 ->with(
'resourceloader.responseTime', $this->
anything() );
1061 $timing->mark(
'requestShutdown' );
1063 $rl->measureResponseTime( $timing );
1064 DeferredUpdates::doUpdates();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static expandModuleNames( $modules)
Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to an array of module names like ‘[ 'jq...
getResourceLoaderContext( $options=[], ResourceLoader $rl=null)
testLessImportDirs()
ResourceLoader::getLessCompiler.
testMakeModuleResponseErrorCSS()
Verify that exceptions in PHP for one module will not break others (stylesheet response).
testMakeLoaderSourcesScript()
ResourceLoader::makeLoaderSourcesScript.
testMakeModuleResponseExtraHeadersMulti()
ResourceLoaderModule::getHeaders ResourceLoaderModule::buildContent ResourceLoader::makeModuleRespons...
testExpandModuleNames( $desc, $modules, $packed, $unpacked=null)
providePackedModules ResourceLoaderContext::expandModuleNames
static providePackedModules()
testAddSourceInvalid()
ResourceLoader::addSource.
testMakeLoaderRegisterScript()
ResourceLoader::makeLoaderRegisterScript.
testRespondEmpty()
ResourceLoader::respond.
getSimpleModuleMock( $script='')
testMakeModuleResponseExtraHeaders()
Integration test for modules sending extra HTTP response headers.
testIsModuleRegistered()
ResourceLoader::isModuleRegistered.
testGetModuleNames()
ResourceLoader::getModuleNames.
testMakeLoaderImplementScriptInvalid()
ResourceLoader::makeLoaderImplementScript.
provideTestIsFileModule()
testRespondInternalFailures()
ResourceLoader::respond.
testGetModuleClass()
ResourceLoader::getModule.
testRegisterDuplicate()
ResourceLoader::register.
testMakeModuleResponseConcat( $scripts, $expected, $debug, $message=null)
Verify how multiple scripts and mw.loader.state() calls are concatenated.
testRegisterValidArray()
ResourceLoader::register ResourceLoader::getModule.
static provideAddSource()
testIsFileModule( $expected, $module)
provideTestIsFileModule ResourceLoader::isFileModule
getSimpleStyleModuleMock( $styles='')
static provideLoaderImplement()
testMakeModuleResponseStartupError()
Verify that when building the startup module response, an exception from one module class will not br...
testAddSourceDupe()
ResourceLoader::addSource.
testGetModuleUnknown()
ResourceLoader::getModule.
testGetLoadScript()
ResourceLoader::getLoadScript.
static provideMakeModuleResponseConcat()
testRegisterValidObject()
ResourceLoader::register ResourceLoader::getModule.
testGetCombinedVersion()
ResourceLoader::getCombinedVersion.
testAddSource( $name, $info, $expected)
provideAddSource ResourceLoader::addSource ResourceLoader::getSources
testMeasureResponseTime()
ResourceLoader::measureResponseTime.
testMakeModuleResponseError()
Verify that when building module content in a load.php response, an exception from one module will no...
testMakeLoaderImplementScript( $case)
provideLoaderImplement ResourceLoader::makeLoaderImplementScript ResourceLoader::trimArray
testMakePackedModulesString( $desc, $modules, $packed)
providePackedModules ResourceLoader::makePackedModulesString
testRegisterInvalidType()
ResourceLoader::register.
testGetModuleClassDefault()
ResourceLoader::getModule.
testRegisterEmptyString()
ResourceLoader::register.
testMakeModuleResponseEmpty()
ResourceLoader::makeModuleResponse.
testRespondSimple()
ResourceLoader::respond.
testRegisterInvalidName()
ResourceLoader::register.
getFailFerryMock( $getter='getScript')
testIsFileModuleUnknown()
ResourceLoader::isFileModule.
testGetModuleFactory()
ResourceLoader::getModule.
testConstructRegistrationHook()
Ensure the ResourceLoaderRegisterModules hook is called.
Dynamic JavaScript and CSS resource loading system.
static makeLoaderSourcesScript( $sources, $loadUrl=null)
Returns JS code which calls mw.loader.addSource() with the given parameters.
static makeLoaderRegisterScript(array $modules)
Returns JS code which calls mw.loader.register with the given parameter.
addSource( $id, $loadUrl=null)
Add a foreign source of modules.
static clearCache()
Reset static members used for caching.
static makePackedModulesString( $modules)
Convert an array of module names to a packed query string.
An interface to help developers measure the performance of their applications.
A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to interpret a given string a...
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
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break anything
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
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 & $ret
Allows to change the fields on the form that will be generated $name
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 such as when responding to a resource loader request or generating HTML output & $resourceLoader
this hook is for auditing only $response
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))