| MediaWiki file: MediaWiki.php | |
|---|---|
| Location: | includes/ | 
| Source code: | master • 1.40.0 • 1.39.4 • 1.35.11 | 
| Classes: | MediaWiki | 
Description
Among other things this file contains:
- Function run, called from index.php. Run the current MediaWiki instance, callingcheckMaxLag,main,triggerJobsandrestInPeace.
- Function checkMaxLag: check if the maximum lag of database slaves is higher thanmaxlagparameter, and if it's the case, output an error message. It's primarily used in requests to api.php, explicitly called by ApiMain.php before 1.19, although since 1.19 it works for index.php requests too.
- Function mainwhich creates a Title object depending on thetitleparameter passed to index.php. If thecuridparameter is passed, it will override thetitle. If thecuridparameter isn't passed and theoldidparameter is passed, it will override thetitleif it's not a special page.
- Function performRequest(before version 1.18 it was calledperformRequestForTitle, and before version 1.16 it was calledinitialize) which does the most of the work. It:
- Checks for invalid titles, or read permission errors
 
- Performs interwiki redirects and canonical redirects
 
- If it's a special page, calls the special page code
 
- Calls initializeArticle, and
 
- Calls 
- Calls performActionifinitializeArticlereturned an article, or
 
- Calls 
- Calls redirectifinitializeArticlereturned a string.
 
- Calls 
- Function initializeArticle, which creates an Article object from the Title given. Then it checks if it is a redirect and if it's the case, recreate another Article from the target of the redirect and changes$wgTitle. It can return either:
- An article object, which will be passed performActionto execute the requested action
 
- An article object, which will be passed 
- A string if it's an interwiki redirect or a redirect to a special page
 
- Function performAction(called byperformRequest) which performs most actions, including creating the HTML. For example, in the case of viewing a page, function "view" in Article.php is called.
- Function restInPeace(called byrun) which does the following:
- Perform deferred updates
 
- Commit any database transactions
 
- Function triggerJobs(doJobsbefore 1.23), which runs zero, one or more jobs from the Job queue, depending on$wgJobRunRate. Called fromrun(it was called fromrestInPeacebefore 1.23).
Hooks
- ArticleFromTitle (introduced in 1.8) now is moved into Article.php
- MediaWikiPerformAction (introduced in 1.12)
- UnknownAction (deprecated in 1.19)(removed in 1.33)
- InitializeArticleMaybeRedirect (introduced in 1.13)
- CustomEditor (introduced in 1.9.1) now is moved into EditAction.php
- BeforeInitialize (introduced in 1.16)
See also
- Manual:Code
- Manual:Coding conventions
    This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.