MediaWiki master
|
Module for ResourceLoader initialization. More...
Inherits MediaWiki\ResourceLoader\Module.
Public Member Functions | |
enableModuleContentVersion () | |
Whether to generate version hash based on module content. | |
getModuleRegistrations (Context $context) | |
Get registration code for all modules. | |
getScript (Context $context) | |
supportsURLLoading () | |
Whether this module supports URL loading. | |
![]() | |
getConfig () | |
getDefinitionSummary (Context $context) | |
Get the definition summary for this module. | |
getDependencies (?Context $context=null) | |
Get a list of modules this module depends on. | |
getDeprecationInformation (Context $context) | |
Get JS representing deprecation information for the current module if available. | |
getDeprecationWarning () | |
Get the deprecation warning, if any. | |
getFlip (Context $context) | |
getGroup () | |
Specifies the group this module is in. | |
getHeaders (Context $context) | |
Get headers to send as part of a module web response. | |
getMessages () | |
Get the messages needed for this module. | |
getModuleContent (Context $context) | |
Get an array of this module's resources. | |
getName () | |
Get this module's name. | |
getOrigin () | |
Get this module's origin. | |
getScriptURLsForDebug (Context $context) | |
Get alternative script URLs for legacy debug mode. | |
getSkins () | |
Get list of skins for which this module must be available to load. | |
getSkipFunction () | |
Get the skip function. | |
getSource () | |
Get the source of this module. | |
getStyles (Context $context) | |
Get all CSS for this module for a given skin. | |
getStyleURLsForDebug (Context $context) | |
Get the URL or URLs to load for this module's CSS in debug mode. | |
getTemplates () | |
Takes named templates by the module and returns an array mapping. | |
getType () | |
Get the module's load type. | |
getVersionHash (Context $context) | |
Get a string identifying the current version of this module in a given context. | |
isKnownEmpty (Context $context) | |
Check whether this module is known to be empty. | |
requiresES6 () | |
Whether the module requires ES6 support in the client. | |
setConfig (Config $config) | |
setFileDependencies (Context $context, array $paths) | |
Set the indirect dependencies for this module pursuant to the skin/language context. | |
setHookContainer (HookContainer $hookContainer) | |
setLogger (LoggerInterface $logger) | |
setMessageBlob ( $blob, $lang) | |
Set in-object cache for message blobs. | |
setName ( $name) | |
Set this module's name. | |
setSkinStylesOverride (array $moduleSkinStyles) | |
Provide overrides for skinStyles to modules that support that. | |
shouldEmbedModule (Context $context) | |
Check whether this module should be embedded rather than linked. | |
shouldSkipStructureTest () | |
Whether to skip the structure test ResourcesTest::testRespond() for this module. | |
Static Public Member Functions | |
static | compileUnresolvedDependencies (array &$registryData) |
Optimize the dependency tree in $this->modules. | |
![]() | |
static | expandRelativePaths (array $filePaths) |
Expand directories relative to $IP. | |
static | getRelativePaths (array $filePaths) |
Make file paths relative to MediaWiki directory. | |
static | getVary (Context $context) |
Get vary string. | |
Static Protected Member Functions | |
static | getImplicitDependencies (array $registryData, string $moduleName, array &$handled) |
Recursively get all explicit and implicit dependencies for to the given module. | |
![]() | |
static | safeFileHash ( $filePath) |
Compute a non-cryptographic string hash of a file's contents. | |
Additional Inherited Members | |
![]() | |
buildContent (Context $context) | |
Bundle all resources attached to this module into an array. | |
getFileDependencies (Context $context) | |
Get the indirect dependencies for this module pursuant to the skin/language context. | |
getHookRunner () | |
Get a HookRunner for running core hooks. | |
getLessVars (Context $context) | |
Get module-specific LESS variables, if any. | |
getLogger () | |
getMessageBlob (Context $context) | |
Get the hash of the message blob. | |
getPreloadLinks (Context $context) | |
Get a list of resources that web browsers may preload. | |
saveFileDependencies (Context $context, array $curFileRefs) | |
Save the indirect dependencies for this module pursuant to the skin/language context. | |
validateScriptFile ( $fileName, $contents) | |
Validate a user-provided JavaScript blob. | |
![]() | |
Config | $config |
array | $contents = [] |
Map of (context hash => cached module content) | |
string bool | $deprecated = false |
Deprecation string or true if deprecated; false otherwise. | |
array | $fileDeps = [] |
Map of (variant => indirect file dependencies) | |
LoggerInterface | $logger |
array | $msgBlobs = [] |
Map of (language => in-object cache for message blob) | |
string null | $name = null |
Module name. | |
int | $origin = self::ORIGIN_CORE_SITEWIDE |
Script and style modules form a hierarchy of trustworthiness, with core modules like skins and jQuery as most trustworthy, and user scripts as least trustworthy. | |
string[] null | $skins = null |
Skin names. | |
array | $versionHash = [] |
Map of (context hash => cached module version hash) | |
Module for ResourceLoader initialization.
See also https://www.mediawiki.org/wiki/ResourceLoader/Features#Startup_Module
The startup module, as being called only from ClientHtml, has the ability to vary based extra query parameters, in addition to those from Context:
Definition at line 45 of file StartUpModule.php.
|
static |
Optimize the dependency tree in $this->modules.
The optimization basically works like this: Given we have module A with the dependencies B and C and module B with the dependency C. Now we don't have to tell the client to explicitly fetch module C as that's already included in module B.
This way we can reasonably reduce the amount of module registration data send to the client.
array[] | &$registryData | Modules keyed by name with properties:
|
Definition at line 136 of file StartUpModule.php.
MediaWiki\ResourceLoader\StartUpModule::enableModuleContentVersion | ( | ) |
Whether to generate version hash based on module content.
If a module requires database or file system access to build the module content, consider disabling this in favour of manually tracking relevant aspects in getDefinitionSummary(). See getVersionHash() for how this is used.
Reimplemented from MediaWiki\ResourceLoader\Module.
Definition at line 453 of file StartUpModule.php.
|
staticprotected |
Recursively get all explicit and implicit dependencies for to the given module.
array | $registryData | |
string | $moduleName | |
array<string,true> | &$handled Internal parameter for recursion. |
CircularDependencyError |
Definition at line 72 of file StartUpModule.php.
MediaWiki\ResourceLoader\StartUpModule::getModuleRegistrations | ( | Context | $context | ) |
Get registration code for all modules.
Context | $context |
Definition at line 161 of file StartUpModule.php.
MediaWiki\ResourceLoader\StartUpModule::getScript | ( | Context | $context | ) |
Context | $context |
Reimplemented from MediaWiki\ResourceLoader\Module.
Definition at line 352 of file StartUpModule.php.
References $IP, MediaWiki\ResourceLoader\Context\encodeJson(), MediaWiki\ResourceLoader\Context\getDebug(), MediaWiki\ResourceLoader\Context\getOnly(), MediaWiki\ResourceLoader\Context\getReqBase(), and MediaWiki\ResourceLoader\Context\getRequest().
MediaWiki\ResourceLoader\StartUpModule::supportsURLLoading | ( | ) |
Whether this module supports URL loading.
If this function returns false, getScript() will be used even in cases (debug mode, no only param) where getScriptURLsForDebug() would normally be used instead.
Reimplemented from MediaWiki\ResourceLoader\Module.
Definition at line 449 of file StartUpModule.php.