Architecture:MediaWiki/entry point layer



The entry point layer consists of all bits of code that are called immediately after initializing the runtime environment. It causes the application to initialize, execute, and terminate. The entry point layer is the top-most layer, no other code may access functionality defined in this layer.

There are several different types of entry points:

User interface entry points are accessible from the web, handle HTTP requests, and generate HTTP responses serving HTML pages and associated assets like images, style sheets, and javascript libraries. Typically, these entry points will first use the wiring layer to bootstrap the application and then transfer control to the user interface layer where the request is interpreted and the response is generated. User interface entry points may not make use of the maintenance layer. The set of user interface entry points in MediaWiki is small, and extensions should not add their own. The most important ones are index.php, load.php, and thumb.php.

API entry points are accessible from the web, handle HTTP requests, and generate machine-readable HTTP responses. Typically, these entry points will first use the wiring layer to bootstrap the application and then transfer control to the API layer where the request is interpreted and the response is generated. API entry points may not make use of the user interface layer or the maintenance layer. The set of API entry points in MediaWiki is small, and extensions should not add their own. The most important such entry points are api.php and rest.php.

Maintenance scripts are scripts run from the command line to perform administrative tasks. Maintenance scripts can be understood as a command line version of API entry points. After bootstrapping the application using the wiring layer, maintenance scripts should transfer control to the maintenance layer. As of version 1.35, each maintenance script acts as its own separate entry point, which means that the maintenance logic resides in the entry point file, while the shared bootstrapping code is pulled in as a utility. This is conceptually backwards, and is bound to change in the future (see T99268). As of version 1.40, invoking maintenance scripts directly from the command line is deprecated in favor of using maintenance/run.php, which fixes the previously mentioned issue. The most important maintenance script is update.php.