MediaWiki  1.28.3
load.mock.php
Go to the documentation of this file.
1 <?php
25 header( 'Content-Type: text/javascript; charset=utf-8' );
26 
27 require_once __DIR__ . '/../../../includes/json/FormatJson.php';
28 require_once __DIR__ . '/../../../includes/Xml.php';
29 
31  'testUsesMissing' => "
32 mw.loader.implement( 'testUsesMissing', function () {
33  QUnit.ok( false, 'Module usesMissing script should not run.' );
34  QUnit.start();
35 }, {}, {});
36 ",
37 
38  'testUsesNestedMissing' => "
39 mw.loader.implement( 'testUsesNestedMissing', function () {
40  QUnit.ok( false, 'Module testUsesNestedMissing script should not run.' );
41  QUnit.start();
42 }, {}, {});
43 ",
44 
45  'testSkipped' =>"
46 mw.loader.implement( 'testSkipped', function () {
47  QUnit.ok( false, 'Module testSkipped was supposed to be skipped.' );
48 }, {}, {});
49 ",
50 
51  'testNotSkipped' =>"
52 mw.loader.implement( 'testNotSkipped', function () {}, {}, {});
53 ",
54 
55  'testUsesSkippable' =>"
56 mw.loader.implement( 'testUsesSkippable', function () {}, {}, {});
57 ",
58 ];
59 
60 $response = '';
61 
62 // Only support for non-encoded module names, full module names expected
63 if ( isset( $_GET['modules'] ) ) {
64  $modules = explode( ',', $_GET['modules'] );
65  foreach ( $modules as $module ) {
66  if ( isset( $moduleImplementations[$module] ) ) {
67  $response .= $moduleImplementations[$module];
68  } else {
69  $response .= Xml::encodeJsCall( 'mw.loader.state', [ $module, 'missing' ], true );
70  }
71  }
72 }
73 
74 echo $response;
$moduleImplementations
Definition: load.mock.php:30
$response
Definition: load.mock.php:60
$modules
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
Definition: distributors.txt:9
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
Definition: injection.txt:35
static encodeJsCall($name, $args, $pretty=false)
Create a call to a JavaScript function.
Definition: Xml.php:682