Manual:Architectural modules/MediaWiki

Responsibilities
MediaWiki is a helper class for the entry point, it controls the full cycle of request processing. MediaWiki fulfills the incoming request starting by determining the right handling: it can be redirect to an Ajax dispatcher (if the request is an Ajax request), redirect to HTTPS (if the request requires HTTPS), it can be served with file cache (if enabled and available) and finally if nothing of the above is applicable, the request will be proceeded further.

Then the incoming request will be checked for errors: invalid title for the requested page or read permission errors. If no error was encountered, it will handle one of 3 cases:
 * InterWiki redirect
 * Request for a SpecialPage
 * Request for an article

The described initial preprocessing of request is shown on figure on the right.

After determining the case, MediaWiki initializes the further processing of request by calling the modules responsible for that. When this job is done, MediaWiki calls the module responsible for the final output of HTML, performs deferred updates, commits database changes and finishes the request.

Implementation Information
Module MediaWiki is implemented as a single class located in the file. The starting point here is the function, that is called by. It calls the function and begins the handling of the request. MediaWiki holds only one member variable - the, that incorporates all the information relevant to the request. consists of:


 * – object with request data (parameters, headers, protocol etc.)
 * – Title object representing the article title
 * – requested WikiPage object
 * – output object for the request
 * – object with information about the user
 * – language object
 * – object responsible for the look of final HTML page
 * – object with configuration variables