Manual:MediaWiki.php
From Linux Web Expert
MediaWiki file: MediaWiki.php | |
---|---|
Location: | includes/ |
Source code: | master • 1.41.1 • 1.40.3 • 1.39.7 |
Classes: | MediaWiki |
Description
<translate> This page is outdated.</translate> |
Among other things this file contains:
- Function
run
, called from index.php. Run the current MediaWiki instance, callingcheckMaxLag
,main
,triggerJobs
andrestInPeace
. - Function
checkMaxLag
: check if the maximum lag of database slaves is higher thanmaxlag
parameter, 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
main
which creates a Title object depending on thetitle
parameter passed to index.php. If thecurid
parameter is passed, it will override thetitle
. If thecurid
parameter isn't passed and theoldid
parameter is passed, it will override thetitle
if 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
performAction
ifinitializeArticle
returned an article, or - Calls
redirect
ifinitializeArticle
returned a string.
- 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
performAction
to execute the requested action - A string if it's an interwiki redirect or a redirect to a special page
- An article object, which will be passed
- 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
(doJobs
before 1.23), which runs zero, one or more jobs from the Job queue, depending on$wgJobRunRate
. Called fromrun
(it was called fromrestInPeace
before 1.23).
Hooks
- ArticleFromTitle <translate> (introduced in <tvar now is moved into Article.php
- MediaWikiPerformAction <translate> (introduced in <tvar
- UnknownAction <translate> (deprecated in <tvar name=2>1.19</tvar>)</translate><translate> (removed in <tvar name=2>1.33</tvar>)</translate>
- InitializeArticleMaybeRedirect <translate> (introduced in <tvar
- CustomEditor <translate> (introduced in <tvar now is moved into EditAction.php
- BeforeInitialize <translate> (introduced in <tvar