Manual:Architectural modules/MediaWiki

Responsibilities Controls the full cycle of request processing
Implementation Single class located in the file Wiki.php

Responsibilities Edit

MediaWiki is a helper class for the index.php 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.

Initial request handling by MediaWiki

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 Edit

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

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