Manual:Index.php

Description
Main script. It creates the necessary global objects and parses the URL to determine what to do, which it then generally passes off to scripts in other files (depending on the action to be taken).

It applies inclusion to WebStart.php, which in turn applies inclusion to LocalSettings.php.

Next it defines class Mediawiki through inclusion of Wiki.php, and creates an object $mediaWiki which is an instance of that class.

It then checks the maxlag parameter, which may cause the request to be rejected.

It calls function checkInitialQueries in Wiki.php, which calls function newFromURL in Title.php (see below) to extract the title and action from the URL.

Many functions do their job by sending content to the $wgOut object. It is created by function initialize (where the name $output is used), and flushed out by function finalCleanup, both in Wiki.php (see below), which flushes that out. If there are any changes that need to be made to the database that can be deferred until after page display, those happen at the end.

Note that the order in the includes is touchy; Language uses some global functions, etc. Likewise with the creation of the global variables. Don't move them around without some forethought.