Architecture:MediaWiki/wiring layer

Jump to navigation Jump to search

The wiring layer (or bootstrap layer) is responsible for defining the network of service objects that makes up the application. It is responsible for bootstrapping the state of the application, based on information from the entry points and configuration. The wiring layer encodes knowledge about how service objects are instantiated. Registration of extensions, along with the mechanisms for integrating them with the rest of the system, such as hooks and registries, also belong to this layer.

The entry point layer resides on top of nearly all layers, the only layer that sits on top of it is the entry point layer.

As per August 2020, the wiring layer is well established around the MediaWikiServices class. However, some wiring logic remains scattered around the code base, typically in static factory methods.

No code in lower levels, particularly no application logic or interaction logic, should know about the wiring layer. it must be used only by code in the entry point layer.

Code in the wiring layer typically knows about classes in all other layers, except the entry point layer.

Typical patterns:
The most important pattern in the wiring layer is the service container.

An example of wiring layer code is ServiceWiring, Setup.php, and ExtensionRegistry.