Manual:Wiki.php

From MediaWiki.org
Jump to: navigation, search
MediaWiki File: Wiki.php
Location: includes/
Source code:

master 1.20.61.19.7

Classes: MediaWiki

Description [edit]

Among other things this file contains:

  • Function checkInitialQueries which creates a Title object depending on the title parameter passed to index.php. If the curid parameter is passed, it will override the title. If the curid parameter isn't passed and the oldid parameter is passed, it will override the title if it's not a special page.
  • Function performRequestForTitle (before version 1.16 it was called initialize) which does the most of the work. It calls:
    • preliminaryChecks
    • handleSpecialCases, and if that function returns false:
      • initializeArticle, and
      • performAction if initializeArticle returned an article, or
      • redirect if initializeArticle returned a string.
  • Function preliminaryChecks, which checks that the page can be seen by the current user (by calling Title::userCanRead()), and output an error if not.
  • Function handleSpecialCases (called by performRequestForTitle) it returns true if it matched a special case (see the list below) and false if the request should continue. Special cases handled by this function:
    • Invalid title
    • Redirects to interwikis links
    • Local redirects if, e.g., no title parameter passed to index.php, ...
    • Special pages
  • 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 and $wgArticle. 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
  • Function performAction (called by performRequestForTitle) 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 finalCleanup (called by index.php) which does the following:
    • Commit any database transactions
    • Flush out all HTML by calling OutputPage::output()
    • Perform deferred updates
    • Run jobs (by calling doJobs
  • Function doJobs, which runs zero, one or more jobs from the Job queue, depending on $wgJobRunRate.

Other functions in Wiki.php:

  • checkMaxLag($maxLag): check if the maximum lag of database slaves is higher than $maxLag, and if it's the case, output an error message. This function is used by ApiMain.php.

Hooks [edit]

See also [edit]

Language: English  • 日本語