手册:index.php

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Index.php and the translation is 62% complete.

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎polski • ‎português do Brasil • ‎русский • ‎中文 • ‎日本語 • ‎한국어

index.php is the main access point for a MediaWiki site. The other main access point is api.phpManual:api.php which handles requests for the MediaWiki APIAPI:Main page.

采取的措施

大部份请求都会令index.php执行以下动作:

  1. First, it includes WebStart.phpManual:WebStart.php, which includes LocalSettings.phpManual:LocalSettings.php and Setup.phpManual:Setup.php.
  2. Next it instantiates a MediaWiki object called $mediaWikiManual:$mediaWiki which is defined in MediaWiki.phpManual:MediaWiki.php.
  3. It then checks the maxlag parameter, which may cause the request to be rejected.
  4. It calls the function MediaWiki::checkInitialQueries() in MediaWiki.phpManual:MediaWiki.php, which creates a TitleManual:Title.php object depending of the title and action parameters from the URL.
  5. If ajax is enabled and the action parameter is set to ajax, then an AjaxDispatcher object will be created to handle that request and the script will stop after that.
  6. Otherwise some globals are stored in $mediaWikiManual:$mediaWiki to be used in the next steps.
  7. It calls MediaWiki::initialize() which does most of the work of the request.
  8. Then MediaWiki::finalCleanup() is called. That function does the deferred updates, runs jobs from the queue depending on $wgJobRunRateManual:$wgJobRunRate and outputs the HTML by calling OutputPage::output().
  9. Finally, MediaWiki::restInPeace() is called to log profiling data.

版本1.18及更高

MediaWiki版本: 1.18

As of MediaWiki version 1.18, some of the startup logic has been moved from index.php, and index.php performs the following actions:

  1. Check the version of PHP and if its not 5.2.3 or higher, display an error.
  2. Include WebStart.phpManual:WebStart.php, which in turn includes LocalSettings.phpManual:LocalSettings.php, Setup.phpManual:Setup.php and some other files.
  3. Instantiate a MediaWiki object called $mediaWikiManual:$mediaWiki, which is defined in MediaWiki.phpManual:MediaWiki.php.
  4. Call $mediaWiki->run().

参见