MediaWiki
master
|
ResourceLoader is a loading system for JavaScript and CSS resources. More...
Public Member Functions | |
__construct (Config $config, LoggerInterface $logger=null, DependencyStore $tracker=null, array $params=[]) | |
addSource ( $sources, $loadUrl=null) | |
Add a foreign source of modules. More... | |
createLoaderURL ( $source, Context $context, array $extraQuery=[]) | |
Build a load.php URL. More... | |
expandUrl (string $base, string $url) | |
Resolve a possibly relative URL against a base URL. More... | |
getCombinedVersion (Context $context, array $moduleNames) | |
Helper method to get and combine versions of multiple modules. More... | |
getConfig () | |
getErrors () | |
getLessCompiler (array $vars=[], array $importDirs=[]) | |
Return a LESS compiler that is set up for use with MediaWiki. More... | |
getLoadScript ( $source) | |
Get the URL to the load.php endpoint for the given ResourceLoader source. More... | |
getLogger () | |
getMessageBlobStore () | |
getModule ( $name) | |
Get the Module object for a given module name. More... | |
getModuleNames () | |
getModulesByMessage ( $messageKey) | |
Get names of modules that use a certain message. More... | |
getSources () | |
Get the list of sources. More... | |
getTestSuiteModuleNames () | |
Get a list of modules with QUnit tests. More... | |
isModuleRegistered ( $name) | |
Check whether a ResourceLoader module is registered. More... | |
loadModuleDependenciesInternal ( $moduleName, $variant) | |
makeModuleResponse (Context $context, array $modules, array $missing=[]) | |
Generate code for a response. More... | |
makeVersionQuery (Context $context, array $modules) | |
Get the expected value of the 'version' query parameter. More... | |
outputErrorAndLog (Exception $e, $msg, array $context=[]) | |
Add an error to the 'errors' array and log it. More... | |
preloadModuleInfo (array $moduleNames, Context $context) | |
Load information stored in the database and dependency tracking store about modules. More... | |
register ( $name, array $info=null) | |
Register a module with the ResourceLoader system. More... | |
registerTestModules () | |
respond (Context $context) | |
Output a response to a load request, including the content-type header. More... | |
saveModuleDependenciesInternal ( $moduleName, $variant, $paths, $priorPaths) | |
setDependencyStore (DependencyStore $tracker) | |
setLogger (LoggerInterface $logger) | |
setMessageBlobStore (MessageBlobStore $blobStore) | |
setModuleSkinStyles (array $moduleSkinStyles) | |
Static Public Member Functions | |
static | clearCache () |
Reset static members used for caching. More... | |
static | ensureNewline ( $str) |
Ensure the string is either empty or ends in a line break. More... | |
static | expandModuleNames ( $modules) |
Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to an array of module names like ‘[ 'jquery.foo’, 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ]`. More... | |
static | filter ( $filter, $data, array $options=[]) |
Run JavaScript or CSS data through a filter, caching the filtered result for future calls. More... | |
static | formatException (Throwable $e) |
Handle exception display. More... | |
static | getSiteConfigSettings (Context $context, Config $conf) |
Get site configuration settings to expose to JavaScript on all pages via mw.config . More... | |
static | getUserDefaults (Context $context, HookContainer $hookContainer, UserOptionsLookup $userOptionsLookup) |
Get user default options to expose to JavaScript on all pages via mw.user.options . More... | |
static | inDebugMode () |
Determine whether debug mode is on. More... | |
static | isValidModuleName ( $moduleName) |
Check a module name for validity. More... | |
static | makeCombinedStyles (array $stylePairs) |
Combines an associative array mapping media type to CSS into a single stylesheet with "@media" blocks. More... | |
static | makeComment ( $text) |
Generate a CSS or JS comment block. More... | |
static | makeConfigSetScript (array $configuration) |
Return JS code which will set the MediaWiki configuration array to the given value. More... | |
static | makeHash ( $value) |
Create a hash for module versioning purposes. More... | |
static | makeInlineCodeWithModule ( $modules, $script) |
Wrap JavaScript code to run after a required module. More... | |
static | makeInlineScript ( $script, $nonce=null) |
Make an HTML script that runs given JS code after startup and base modules. More... | |
static | makeLoaderConditionalScript ( $script) |
Wrap JavaScript code to run after the startup module. More... | |
static | makeLoaderQuery (array $modules, $lang, $skin, $user=null, $version=null, $debug=Context::DEBUG_OFF, $only=null, $printable=false, $handheld=null, array $extraQuery=[]) |
Build a query array (array representation of query string) for load.php. More... | |
static | makeLoaderRegisterScript (Context $context, array $modules) |
Format JS code which calls mw.loader.register() with the given parameters. More... | |
static | makeLoaderSourcesScript (Context $context, array $sources) |
Format JS code which calls mw.loader.addSource() with the given parameters. More... | |
static | makeLoaderStateScript (Context $context, array $states) |
Format a JS call to mw.loader.state() More... | |
static | makePackedModulesString (array $modules) |
Convert an array of module names to a packed query string. More... | |
Public Attributes | |
const | HASH_LENGTH = 5 |
Protected Member Functions | |
measureResponseTime () | |
Send stats about the time used to build the response. More... | |
sendResponseHeaders (Context $context, $etag, $errors, array $extra=[]) | |
Send main response headers to the client. More... | |
tryRespondNotModified (Context $context, $etag) | |
Respond with HTTP 304 Not Modified if appropriate. More... | |
Static Protected Member Functions | |
static | createLoaderQuery (Context $context, array $extraQuery=[]) |
Helper for createLoaderURL() More... | |
static | formatExceptionNoComment (Throwable $e) |
Handle exception display. More... | |
Protected Attributes | |
array | $errors = [] |
Errors accumulated during a respond() call. More... | |
string[] | $extraHeaders = [] |
Buffer for extra response headers during a makeModuleResponse() call. More... | |
Static Protected Attributes | |
static int null | $debugMode = null |
ResourceLoader is a loading system for JavaScript and CSS resources.
For higher level documentation, see https://www.mediawiki.org/wiki/ResourceLoader/Architecture.
Definition at line 95 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::__construct | ( | Config | $config, |
LoggerInterface | $logger = null , |
||
DependencyStore | $tracker = null , |
||
array | $params = [] |
||
) |
Config | $config | Generic pass-through for use by extension callbacks and other MediaWiki-specific module classes. |
LoggerInterface | null | $logger | [optional] |
DependencyStore | null | $tracker | [optional] |
array | $params | [optional]
|
Definition at line 177 of file ResourceLoader.php.
References MediaWiki\ResourceLoader\ResourceLoader\addSource(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\ResourceLoader\ResourceLoader\setDependencyStore(), and MediaWiki\ResourceLoader\ResourceLoader\setMessageBlobStore().
MediaWiki\ResourceLoader\ResourceLoader::addSource | ( | $sources, | |
$loadUrl = null |
|||
) |
Add a foreign source of modules.
Source IDs are typically the same as the Wiki ID or database name (e.g. lowercase a-z).
array | string | $sources | Source ID (string), or [ id1 => loadUrl, id2 => loadUrl, ... ] |
string | array | null | $loadUrl | load.php url (string), or array with loadUrl key for backwards-compatibility. |
InvalidArgumentException | If array-form $loadUrl lacks a 'loadUrl' key. |
Definition at line 346 of file ResourceLoader.php.
References $source.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\__construct().
|
static |
Reset static members used for caching.
Global state and $wgRequest are evil, but we're using it right now and sometimes we need to be able to force ResourceLoader to re-evaluate the context because it has changed (e.g. in the test suite).
Definition at line 1913 of file ResourceLoader.php.
|
staticprotected |
Helper for createLoaderURL()
Context | $context | |
array | $extraQuery |
Definition at line 1944 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::createLoaderURL | ( | $source, | |
Context | $context, | ||
array | $extraQuery = [] |
||
) |
Build a load.php URL.
string | $source | Name of the ResourceLoader source |
Context | $context | |
array | $extraQuery |
Definition at line 1926 of file ResourceLoader.php.
|
static |
Ensure the string is either empty or ends in a line break.
string | $str |
Definition at line 1339 of file ResourceLoader.php.
|
static |
Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux
to an array of module names like ‘[ 'jquery.foo’, 'jquery.bar', 'jquery.ui.baz', 'jquery.ui.quux' ]`.
This process is reversed by ResourceLoader::makePackedModulesString().
string | $modules | Packed module name list |
Definition at line 1852 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
MediaWiki\ResourceLoader\ResourceLoader::expandUrl | ( | string | $base, |
string | $url | ||
) |
Resolve a possibly relative URL against a base URL.
The base URL must have a server and should have a protocol. A protocol-relative base expands to HTTPS.
This is a standalone version of MediaWiki's UrlUtils::expand (T32956).
string | $base | |
string | $url |
Definition at line 2118 of file ResourceLoader.php.
|
static |
Run JavaScript or CSS data through a filter, caching the filtered result for future calls.
Available filters are:
If $data is empty, only contains whitespace or the filter was unknown, $data is returned unmodified.
string | $filter | Name of filter to run |
string | $data | Text to filter, such as JavaScript or CSS text |
array<string,bool> | $options Keys:
|
Definition at line 2150 of file ResourceLoader.php.
|
static |
Handle exception display.
Throwable | $e | Exception to be shown to the user |
Definition at line 1048 of file ResourceLoader.php.
|
staticprotected |
Handle exception display.
Throwable | $e | Exception to be shown to the user |
Definition at line 1059 of file ResourceLoader.php.
References MWExceptionHandler\getLogMessage(), MWExceptionHandler\getPublicLogMessage(), MWExceptionHandler\getRedactedTraceAsString(), and MWExceptionRenderer\shouldShowExceptionDetails().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\outputErrorAndLog().
MediaWiki\ResourceLoader\ResourceLoader::getCombinedVersion | ( | Context | $context, |
array | $moduleNames | ||
) |
Helper method to get and combine versions of multiple modules.
Context | $context | |
string[] | $moduleNames | List of known module names |
Definition at line 686 of file ResourceLoader.php.
References MediaWiki\ResourceLoader\ResourceLoader\getModule(), MediaWiki\ResourceLoader\ResourceLoader\makeHash(), and MediaWiki\ResourceLoader\ResourceLoader\outputErrorAndLog().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\makeVersionQuery(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\ResourceLoader::getConfig | ( | ) |
Definition at line 214 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\getModule(), MediaWiki\ResourceLoader\SkinModule\getStyleFiles(), and MediaWiki\ResourceLoader\SkinModule\getStyles().
MediaWiki\ResourceLoader\ResourceLoader::getErrors | ( | ) |
MediaWiki\ResourceLoader\ResourceLoader::getLessCompiler | ( | array | $vars = [] , |
array | $importDirs = [] |
||
) |
Return a LESS compiler that is set up for use with MediaWiki.
array | $vars | Associative array of variables that should be used for compilation. Since 1.32, this method no longer automatically includes global LESS vars from ResourceLoader::getLessVars (T191937). |
array | $importDirs | Additional directories to look in for @import (since 1.36) |
Definition at line 2042 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::getLoadScript | ( | $source | ) |
Get the URL to the load.php endpoint for the given ResourceLoader source.
string | $source | Source ID |
UnexpectedValueException | If the source ID was not registered |
Definition at line 575 of file ResourceLoader.php.
References $source.
MediaWiki\ResourceLoader\ResourceLoader::getLogger | ( | ) |
Definition at line 230 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\Context\__construct().
MediaWiki\ResourceLoader\ResourceLoader::getMessageBlobStore | ( | ) |
Definition at line 238 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\preloadModuleInfo().
MediaWiki\ResourceLoader\ResourceLoader::getModule | ( | $name | ) |
Get the Module object for a given module name.
If an array of module parameters exists but a Module object has not yet been instantiated, this method will instantiate and cache that object such that subsequent calls simply return the same object.
string | $name | Module name |
Definition at line 408 of file ResourceLoader.php.
References MediaWiki\ResourceLoader\ResourceLoader\getConfig().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\getCombinedVersion(), MediaWiki\ResourceLoader\ResourceLoader\makeVersionQuery(), MediaWiki\ResourceLoader\ResourceLoader\preloadModuleInfo(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\ResourceLoader::getModuleNames | ( | ) |
Definition at line 371 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::getModulesByMessage | ( | $messageKey | ) |
Get names of modules that use a certain message.
string | $messageKey |
Definition at line 1353 of file ResourceLoader.php.
|
static |
Get site configuration settings to expose to JavaScript on all pages via mw.config
.
Definition at line 2240 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::getSources | ( | ) |
Get the list of sources.
Definition at line 563 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::getTestSuiteModuleNames | ( | ) |
Get a list of modules with QUnit tests.
Definition at line 382 of file ResourceLoader.php.
|
static |
Get user default options to expose to JavaScript on all pages via mw.user.options
.
Context | $context | |
HookContainer | $hookContainer | |
UserOptionsLookup | $userOptionsLookup |
Definition at line 2217 of file ResourceLoader.php.
|
static |
Determine whether debug mode is on.
Order of priority is:
Definition at line 1889 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::isModuleRegistered | ( | $name | ) |
Check whether a ResourceLoader module is registered.
string | $name |
Definition at line 393 of file ResourceLoader.php.
|
static |
Check a module name for validity.
Module names may not contain pipes (|), commas (,) or exclamation marks (!) and can be at most 255 bytes.
string | $moduleName | Module name to check |
Definition at line 2027 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::loadModuleDependenciesInternal | ( | $moduleName, | |
$variant | |||
) |
string | $moduleName | |
string | $variant | Language/skin variant |
Definition at line 494 of file ResourceLoader.php.
References MediaWiki\ResourceLoader\Module\expandRelativePaths().
|
static |
Combines an associative array mapping media type to CSS into a single stylesheet with "@media" blocks.
array<string,string|string[]> | $stylePairs Map from media type to CSS string(s) |
Definition at line 1561 of file ResourceLoader.php.
|
static |
Generate a CSS or JS comment block.
Only use this for public data, not error message details.
string | $text |
Definition at line 1037 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\WikiModule\getScript(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
|
static |
Return JS code which will set the MediaWiki configuration array to the given value.
array | $configuration | List of configuration values keyed by variable name |
Exception |
Definition at line 1798 of file ResourceLoader.php.
|
static |
Create a hash for module versioning purposes.
This hash is used in three ways:
To differentiate between the current version and a past version of a module by the same name.
In the cache key of localStorage in the browser (mw.loader.store). This store keeps only one version of any given module. As long as the next version the client encounters has a different hash from the last version it saw, it will correctly discard it in favour of a network fetch.
A browser may evict a site's storage container for any reason (e.g. when the user hasn't visited a site for some time, and/or when the device is low on storage space). Anecdotally it seems devices rarely keep unused storage beyond 2 weeks on mobile devices and 4 weeks on desktop. But, there is no hard limit or expiration on localStorage. ResourceLoader's Client also clears localStorage when the user changes their language preference or when they (temporarily) use Debug Mode.
The only hard factors that reduce the range of possible versions are 1) the name and existence of a given module, and 2) the TTL for mw.loader.store, and 3) the $wgResourceLoaderStorageVersion
configuration variable.
To identify a batch response of modules from load.php in an HTTP cache.
When fetching modules in a batch from load.php, a combined hash is created by the JS code, and appended as query parameter.
In cache proxies (e.g. Varnish, Nginx) and in the browser's HTTP cache, these urls are used to identify other previously cached responses. The range of possible versions a given version has to be unique amongst is determined by the maximum duration each response is stored for, which is controlled by ‘$wgResourceLoaderMaxage['versioned’]`.
To detect race conditions between multiple web servers in a MediaWiki deployment of which some have the newer version and some still the older version.
An HTTP request from a browser for the Startup manifest may be responded to by a server with the newer version. The browser may then use that to request a given module, which may then be responded to by a server with the older version. To avoid caching this for too long (which would pollute all other users without repairing itself), the combined hash that the JS client adds to the url is verified by the server (in ::sendResponseHeaders). If they don't match, we instruct cache proxies and clients to not cache this response as long as they normally would. This is also the reason that the algorithm used here in PHP must match the one used in JS.
The fnv132 digest creates a 32-bit integer, which goes upto 4 Giga and needs up to 7 chars in base 36. Within 7 characters, base 36 can count up to 78,364,164,096 (78 Giga), (but with fnv132 we'd use very little of this range, mostly padding). Within 6 characters, base 36 can count up to 2,176,782,336 (2 Giga). Within 5 characters, base 36 can count up to 60,466,176 (60 Mega).
string | $value |
Definition at line 649 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\getCombinedVersion().
|
static |
Wrap JavaScript code to run after a required module.
string | string[] | $modules | Module name(s) |
string | $script | JavaScript code |
Definition at line 1763 of file ResourceLoader.php.
|
static |
Make an HTML script that runs given JS code after startup and base modules.
The code will be wrapped in a closure, and it will be executed by ResourceLoader's startup module if the client has adequate support for MediaWiki JavaScript code.
string | $script | JavaScript code |
string | null | $nonce | Unused |
Definition at line 1781 of file ResourceLoader.php.
|
static |
Wrap JavaScript code to run after the startup module.
string | $script | JavaScript code |
Definition at line 1749 of file ResourceLoader.php.
|
static |
Build a query array (array representation of query string) for load.php.
Helper function for createLoaderURL().
string[] | $modules | |
string | $lang | |
string | $skin | |
string | null | $user | |
string | null | $version | |
int | $debug | |
string | null | $only | |
bool | $printable | |
bool | null | $handheld | Unused as of MW 1.38 |
array | $extraQuery |
Definition at line 1977 of file ResourceLoader.php.
|
static |
Format JS code which calls mw.loader.register()
with the given parameters.
Context | $context | |
array[] | $modules | Array of module registration arrays, each containing
|
Definition at line 1694 of file ResourceLoader.php.
|
static |
Format JS code which calls mw.loader.addSource()
with the given parameters.
Context | $context | |
array<string,string> | $sources |
Definition at line 1735 of file ResourceLoader.php.
|
static |
Format a JS call to mw.loader.state()
Context | $context | |
array<string,string> | $states |
Definition at line 1623 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::makeModuleResponse | ( | Context | $context, |
array | $modules, | ||
array | $missing = [] |
||
) |
Generate code for a response.
Calling this method also populates the errors
and headers
members, later used by respond().
Context | $context | Context in which to generate a response |
Module[] | $modules | List of module objects keyed by module name |
string[] | $missing | List of requested module names that are unregistered (optional) |
Definition at line 1080 of file ResourceLoader.php.
References $modules, MediaWiki\ResourceLoader\Context\encodeJson(), MediaWiki\ResourceLoader\Context\getDebug(), MediaWiki\ResourceLoader\Context\getImageObj(), MediaWiki\ResourceLoader\Context\getOnly(), MediaWiki\ResourceLoader\Context\getRaw(), MediaWiki\ResourceLoader\Context\isSourceMap(), and MediaWiki\ResourceLoader\Context\shouldIncludeScripts().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
|
static |
Convert an array of module names to a packed query string.
For example, ‘[ 'foo.bar’, 'foo.baz', 'bar.baz', 'bar.quux' ] becomes
'foo.bar,baz|bar.baz,quux'`.
This process is reversed by ResourceLoader::expandModuleNames(). See also mw.loader::buildModulesString() which is a port of this, used on the client-side.
string[] | $modules | List of module names (strings) |
Definition at line 1824 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::makeVersionQuery | ( | Context | $context, |
array | $modules | ||
) |
Get the expected value of the 'version' query parameter.
This is used by respond() to set a short Cache-Control header for requests with information newer than the current server has. This avoids pollution of edge caches. Typically during deployment. (T117587)
This MUST match return value of mw.loader#getCombinedVersion()
client-side.
Context | $context | |
string[] | $modules |
Definition at line 726 of file ResourceLoader.php.
References $modules, MediaWiki\ResourceLoader\ResourceLoader\getCombinedVersion(), and MediaWiki\ResourceLoader\ResourceLoader\getModule().
|
protected |
Send stats about the time used to build the response.
Definition at line 875 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\ResourceLoader::outputErrorAndLog | ( | Exception | $e, |
$msg, | |||
array | $context = [] |
||
) |
Add an error to the 'errors' array and log it.
Exception | $e | |
string | $msg | |
array | $context |
Definition at line 669 of file ResourceLoader.php.
References MediaWiki\ResourceLoader\ResourceLoader\formatExceptionNoComment(), and MWExceptionHandler\logException().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\getCombinedVersion(), and MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\ResourceLoader::preloadModuleInfo | ( | array | $moduleNames, |
Context | $context | ||
) |
Load information stored in the database and dependency tracking store about modules.
string[] | $moduleNames | |
Context | $context | ResourceLoader-specific context of the request |
Definition at line 445 of file ResourceLoader.php.
References DB_REPLICA, MediaWiki\ResourceLoader\Module\expandRelativePaths(), MediaWiki\ResourceLoader\Context\getLanguage(), MediaWiki\ResourceLoader\ResourceLoader\getMessageBlobStore(), MediaWiki\ResourceLoader\ResourceLoader\getModule(), MediaWiki\ResourceLoader\Module\getVary(), MediaWiki\ResourceLoader\WikiModule\preloadTitleInfo(), and wfGetDB().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\ResourceLoader::register | ( | $name, | |
array | $info = null |
||
) |
Register a module with the ResourceLoader system.
string | array[] | $name | Module name as a string or, array of module info arrays keyed by name. |
array | null | $info | Module info array. When using the first parameter to register multiple modules at once, this parameter is optional. |
InvalidArgumentException | If a module name contains illegal characters (pipes or commas) |
InvalidArgumentException | If the module info is not an array |
Definition at line 277 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::registerTestModules | ( | ) |
Definition at line 310 of file ResourceLoader.php.
MediaWiki\ResourceLoader\ResourceLoader::respond | ( | Context | $context | ) |
Output a response to a load request, including the content-type header.
Definition at line 749 of file ResourceLoader.php.
References $modules, MediaWiki\ResourceLoader\Context\encodeJson(), MediaWiki\ResourceLoader\ResourceLoader\getCombinedVersion(), MediaWiki\ResourceLoader\Context\getDebug(), MediaWiki\ResourceLoader\Context\getImage(), MediaWiki\ResourceLoader\Context\getImageObj(), MediaWiki\ResourceLoader\ResourceLoader\getModule(), MediaWiki\ResourceLoader\Context\getModules(), MediaWiki\ResourceLoader\Context\getOnly(), MediaWiki\ResourceLoader\Context\getVersion(), MediaWiki\ResourceLoader\Context\isSourceMap(), MediaWiki\ResourceLoader\ResourceLoader\makeComment(), MediaWiki\ResourceLoader\ResourceLoader\makeModuleResponse(), MediaWiki\ResourceLoader\ResourceLoader\measureResponseTime(), MW_ENTRY_POINT, MediaWiki\ResourceLoader\ResourceLoader\outputErrorAndLog(), MediaWiki\ResourceLoader\ResourceLoader\preloadModuleInfo(), MediaWiki\MainConfigNames\ResourceLoaderEnableSourceMapLinks, MediaWiki\ResourceLoader\ResourceLoader\sendResponseHeaders(), MediaWiki\ResourceLoader\Context\shouldIncludeScripts(), Profiler\ProfilingContext\singleton(), and MediaWiki\ResourceLoader\ResourceLoader\tryRespondNotModified().
MediaWiki\ResourceLoader\ResourceLoader::saveModuleDependenciesInternal | ( | $moduleName, | |
$variant, | |||
$paths, | |||
$priorPaths | |||
) |
string | $moduleName | |
string | $variant | Language/skin variant |
string[] | $paths | List of relative paths referenced during computation |
string[] | $priorPaths | List of relative paths tracked in the dependency store |
Definition at line 507 of file ResourceLoader.php.
References DeferredUpdates\addCallableUpdate(), and ObjectCache\getLocalClusterInstance().
|
protected |
Send main response headers to the client.
Deals with Content-Type, CORS (for stylesheets), and caching.
Context | $context | |
string | $etag | ETag header value |
bool | $errors | Whether there are errors in the response |
string[] | $extra | Array of extra HTTP response headers |
Definition at line 893 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
MediaWiki\ResourceLoader\ResourceLoader::setDependencyStore | ( | DependencyStore | $tracker | ) |
DependencyStore | $tracker |
Definition at line 254 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\__construct().
MediaWiki\ResourceLoader\ResourceLoader::setLogger | ( | LoggerInterface | $logger | ) |
MediaWiki\ResourceLoader\ResourceLoader::setMessageBlobStore | ( | MessageBlobStore | $blobStore | ) |
MessageBlobStore | $blobStore |
Definition at line 246 of file ResourceLoader.php.
Referenced by MediaWiki\ResourceLoader\ResourceLoader\__construct().
MediaWiki\ResourceLoader\ResourceLoader::setModuleSkinStyles | ( | array | $moduleSkinStyles | ) |
array | $moduleSkinStyles |
Definition at line 262 of file ResourceLoader.php.
|
protected |
Respond with HTTP 304 Not Modified if appropriate.
If there's an If-None-Match header, respond with a 304 appropriately and clear out the output buffer. If the client cache is too old then do nothing.
Context | $context | |
string | $etag | ETag header value |
Definition at line 966 of file ResourceLoader.php.
References MediaWiki\ResourceLoader\Context\getDebug(), MediaWiki\ResourceLoader\Context\getRequest(), HttpStatus\header(), and wfResetOutputBuffers().
Referenced by MediaWiki\ResourceLoader\ResourceLoader\respond().
|
staticprotected |
Definition at line 109 of file ResourceLoader.php.
|
protected |
Errors accumulated during a respond() call.
Exposed for testing.
Definition at line 143 of file ResourceLoader.php.
|
protected |
Buffer for extra response headers during a makeModuleResponse() call.
Exposed for testing.
Definition at line 148 of file ResourceLoader.php.
const MediaWiki\ResourceLoader\ResourceLoader::HASH_LENGTH = 5 |
Definition at line 585 of file ResourceLoader.php.