Manual:Code

From MediaWiki.org
Jump to: navigation, search

Contents

This page describes key files and directories in the MediaWiki source code. For more detailed information, see the class, file and comprehensive references auto-generated from the MediaWiki source code using doxygen.

[edit] Access points

File Description
index.php Main access point for the MediaWiki software. It handles most requests made to MediaWiki. For more information, read Manual:Index.php.
api.php External access point for MediaWiki's API. For more information, read Manual:Api.php.
load.php Script for the front-end to hook into for loading ResourceLoader modules For more information, read Manual:Load.php.
img_auth.php Script that only serves images to logged in users. To configure the wiki to use that script, see Manual:Image Authorisation. For more information, read Manual:Img_auth.php.
opensearch_desc.php Returns an OpenSearch description document that describes the web interface of MediaWiki's search engine. For more information, read Manual:Opensearch_desc.php.
profileinfo.php Allow users to see the profiling information that are stored in the database. See How to debug#Profiling. For more information, read Manual:Profileinfo.php.
redirect.php Script that redirects to the article passed in the wpDropdown parameter of the request. Needed for Nostalgia skin. For more information, read Manual:Redirect.php.
thumb.php Script used to resize images. For more information, read Manual:Thumb.php.
thumb_handler.php Access to thumbnails using HTTP-errors (Status Code 404) For more information, read Manual:Thumb_handler.php.
trackback.php Adds trackbacks to the database. Removed in MediaWiki 1.19 (r104051). For more information, read Manual:Trackback.php.

[edit] Directory /includes/

This directory stores common include files needed by MediaWiki.

File Description
includes/Article.php Contains the Article class, which provides methods to view, modify and manage articles. This maintains WikiPage functions for backwards compatibility. For more information, read Manual:Article.php.
includes/Defines.php Defines several constants, suchs as those for namespaces, which are used by other files and classes. For more information, read Manual:Defines.php.
includes/EditPage.php Provides much of the code related to the editing user interface For more information, read Manual:EditPage.php.
includes/GlobalFunctions.php Contains globally used functions like wfMsgExt For more information, read Manual:GlobalFunctions.php.
includes/LinkCache.php For more information, read Manual:LinkCache.php.
includes/Linker.php Contains methods to create internal, external or image links and implements page existence detection. For more information, read Manual:Linker.php.
includes/OutputPage.php Hold HTML and wikitext parsing. Will also generate the <head> element or part of it. For more information, read Manual:OutputPage.php.
includes/Pager.php Contains the IndexPager class used for paging results of MySQL queries. For more information, read Manual:Pager.php.
includes/Parser.php Contains most of the code that converts wikitext to HTML (though few bits and pieces are in Manual:Skin.php.) For more information, read Manual:Parser.php.
includes/Setup.php Include commonly used files and initializes the global object variables so that MediaWiki can work. For more information, read Manual:Setup.php.
includes/Skin.php Encapsulates a "look and feel" for the wiki. For more information, read Manual:Skin.php.
includes/SpecialPage.php Contains the SpecialPage class, which is the parent class for all special page classes. It also makes available several static functions for handling the special page list and several other special page classes, like RedirectSpecialPage and IncludableSpecialPage. For more information, read Manual:SpecialPage.php.
includes/Title.php Represents the title of an article, and does all the work of translating among various forms such as plain text, URL, database key, etc. For convenience, and for historical reasons, it also represents a few features of articles that don't involve their text, such as access rights. For more information, read Manual:Title.php.
includes/User.php Encapsulates the state of the user viewing/using the site. Can be queried for things like the user's settings, name, etc. Handles the details of getting and saving to the user table of the database, and dealing with sessions and cookies. For more information, read Manual:User.php.
includes/UserMailer.php Collection of static functions for sending mail. For more information, read Manual:UserMailer.php.
includes/WebRequest.php This file contains the definition of the WebRequest class. For more information, read Manual:WebRequest.php.
includes/WebStart.php It does the initial setup for a web request: security checks, loads LocalSettings.php and Setup.php. For more information, read Manual:WebStart.php.
includes/Wiki.php This file consists of the definition of the class MediaWiki. For more information, read Manual:Wiki.php.
includes/WikiPage.php Contains the WikiPage class, which represents an article in the wiki. For more information, read Manual:WikiPage.php.

[edit] Directory /includes/actions/

This directory contains the definitions of Action classes to handle different actions. All these classes extend the Action, FormlessAction or FormAction classes.

File Description
includes/actions/CreditsAction.php Handles formatting the credits for articles. For more information, read Manual:CreditsAction.php.
includes/actions/DeleteAction.php Handles page deletion. For more information, read Manual:DeleteAction.php.
includes/actions/EditAction.php Contains classes EditAction and SubmitAction which handle the edit and submitting actions. For more information, read Manual:EditAction.php.
includes/actions/HistoryAction.php Handles printing the history page for an article. For more information, read Manual:HistoryAction.php.
includes/actions/InfoAction.php Displays informations about a page, like the total number of edits and number of unique editors. For more information, read Manual:InfoAction.php.
includes/actions/MarkpatrolledAction.php Handles marking a revision as patrolled. For more information, read Manual:MarkpatrolledAction.php.
includes/actions/ProtectAction.php Handles protecting a page. For more information, read Manual:ProtectAction.php.
includes/actions/PurgeAction.php Handles purging a page. For more information, read Manual:PurgeAction.php.
includes/actions/RawAction.php Handles the "action=raw" action. For more information, read Manual:RawAction.php.
includes/actions/RenderAction.php Handles the render action, which shows an HTML rendering of the page; similar to the view action, but only the unstyled article text is shown, not the additional toolboxes, search boxes, stylesheets, etc. For more information, read Manual:RenderAction.php.
includes/actions/RevertAction.php Contains class RevertFileAction, which handles reverting a file. For more information, read Manual:RevertAction.php.
includes/actions/RevisiondeleteAction.php Handles the revision delete action by just passing the request to Special:RevisionDelete. For more information, read Manual:RevisiondeleteAction.php.
includes/actions/RollbackAction.php Handles rolling back a page. For more information, read Manual:RollbackAction.php.
includes/actions/ViewAction.php Handles the viewing of page, by calling Article::view. For more information, read Manual:ViewAction.php.
includes/actions/WatchAction.php Contains classes WatchAction and UnwatchAction, which handle watching and unwatching a page. For more information, read Manual:WatchAction.php.

[edit] Directory /includes/api/

This directory contains the code for the MediaWiki API. See API:Main page. The most important files are:

File Description
includes/api/ApiBase.php The base class for all API classes. Has a lot of common code for all API actions. Inherits class ContextSource For more information, read Manual:ApiBase.php.
includes/api/ApiFormatBase.php The base class for all formatting classes. Inherits ApiBase. For more information, read Manual:ApiFormatBase.php.
includes/api/ApiQueryBase.php The base class for all query API classes. Inherits ApiBase. For more information, read Manual:ApiQueryBase.php.

[edit] Directory /includes/db/

This directory contains the code for database support. Database.php provides MediaWiki's database abstraction layer.

[edit] Directory /includes/specials/

This directory contains the code and classes for the standard special pages. All special page classes derive from class SpecialPage (defined in includes/SpecialPage.php). Special pages which come with extension are located in their respective extensions directories. See also Manual:Special pages.

[edit] Directory /languages/

This directory contains files used for localization and internationalization.

File Description
languages/Language.php Contains the Language class, it represents the language used for incidental text, and also has some character encoding functions and other locale stuff. Two globals contain an instance of this class: $wgContLang for the site language and $wgLang for the user language. For more information, read Manual:Language.php.

[edit] Directory /maintenance/

This directory contains maintenance scripts that must be run from a command line interface.

See Manual:Maintenance scripts for an overview of those scripts.

[edit] Directory /resources/

[edit] Directory /skins/

This directory contain all skins classes, JavaScripts, CSS and some images used by that skins.

Language: English  • Français • Bahasa Indonesia • 日本語 • Português do Brasil • Русский • ‪中文(简体)‬
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox