MediaWiki Softwares

De JFCM
Aller à : navigation, rechercher


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.


wiki root[modifier]

These are the files that a browser may reach when using the wiki. All of them are located in the root directory of the wiki, and each of them is paired with a .php5 wrapper, for web servers that require the .php5 extension to execute scripts with the PHP5 engine.

  • ​index.php
    Main access point for the MediaWiki software. It handles most requests made to MediaWiki.
  • ​api.php
    External access point for MediaWiki's API. The MediaWiki action API is a web service that provides convenient access to wiki features, data, and meta-data over HTTP, via a URL usually at api.php. Clients request particular "actions" by specifying an action parameter, mainly action=query to get information. It was known as the MediaWiki API, but there are now other web APIs available that connect to MediaWiki such as RESTBase and the Wikidata query service.
  • ​load.php
    Script for the front-end to hook into for loading ResourceLoader modules.
  • ​img_auth.php
    Script that only serves images to logged in users. To configure the wiki to use that script, see Manual:Image Authorisation.
  • ​opensearch_desc.php
    Returns an OpenSearch description document that describes the web interface of MediaWiki's search engine.
  • ​profileinfo.php
    Allow users to see the profiling information that are stored in the database. See Manual:How to debug#Profiling.
  • ​redirect.php
    Script that redirects to the article passed in the wpDropdown parameter of the request. Needed for Nostalgia skin Removed in 1.22
  • ​thumb_handler.php
    PHP script to be used as 404 handler to create and stream out a not yet existing image thumbnail.
  • ​trackback.php
    Adds trackbacks to the database. Removed in MediaWiki 1.19 (r104051).

Except thumb_handler.php, which is a simple wrapper around thumb.php and thus does not have to re-include WebStart.php

1. That command also returns mw-config/index.php, but unlike the other files, it is not intended for repeated use during normal wiki operation; in other words, it is not an access point to reach wiki resources, but a one-off script to launch the configuration process of a newly installed wiki.

/cache/[modifier]

Default location for the file cache, if enabled (by setting $wgUseFileCache = true; — the default is false.). This location can be customized using $wgFileCacheDirectory.

/docs/[modifier]

Contains various text files that should help you understand the most important parts of the code of MediaWiki.

/extensions/[modifier]

Mediawiki extensions are distributed separately from the core code. Installing an extension entails copying its files into this directory, and enabling it by following the extension's own installation instructions (usually editing the LocalSettings.php file). In current versions a set of several extensions is distributed with a fresh MediaWiki install.

/includes/[modifier]

This directory stores common include files needed by MediaWiki.

  • includes/​Article.php
    Contains the Article class, which provides methods to view, modify and manage articles. This maintains WikiPage functions for backwards compatibility.
  • includes/​Defines.php
    Defines several constants, suchs as those for namespaces, which are used by other files and classes.
  • includes/​Linker.php
    Contains methods to create internal, external or image links and implements page existence detection.
  • includes/​Message.php
    Provides methods for: fetching interface messages; processing messages into a variety of formats. See Manual:Messages API.
  • includes/​Parser.php
    Contains most of the code that converts wikitext to HTML (though few bits and pieces are in Manual:Skin.php).
  • includes/​Setup.php
    Include commonly used files and initializes the global object variables so that MediaWiki can work.
  • 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. See Manual:Special pages.
  • 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.
  • 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.
  • includes/​WebStart.php
    It does the initial setup for a web request: security checks, loads LocalSettings.php and Setup.php.

/includes/actions/[modifier]

This directory contains the Action classes, which handle the different actions which can be performed on pages (e.g. view, delete, edit, etc.). All these classes extend the Action, FormlessAction or FormAction classes. Some of them are just stubs which call methods in the Article or EditPage classes to do the actual work.

  • 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.

/includes/api/[modifier]

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

  • includes/api/​ApiBase.php
    The base class for all API classes. Has a lot of common code for all API actions. Inherits ContextSource class

/includes/cache/[modifier]

This directory contains files with code relating to MediaWiki's caching mechanisms.

  • cache/​FileCacheBase.php
    The FileCacheBase class is the base class for classes which provide a file based cache scheme. See Manual:File cache.
  • cache/​LinkCache.php
    Caching for article titles (prefixed DB keys) and ids linked from one source. See also LINKCACHE.TXT.
  • cache/​MemcachedSessions.php
    This file gets included if $wgSessionsInMemcache is set in the config. It redirects session handling functions to store their data in memcached instead of the local filesystem.

/includes/context/[modifier]

This directory contains a few classes related to (request) contexts. As of MediaWiki 1.18 the context of a request is encapsulated inside a RequestContext instance which implements IContextSource. A context is a way of grouping the parts of a request together. This reduces the need for globals. See Manual:RequestContext.php for more information.

  • includes/context/​ContextSource.php
    The ContextSource class implements the IContextSource interface. It is a helper class: by making a class extend ContextSource the class will be provided with the various getOutput, getSkin, getLanguage, etc. helpers directly and will implement IContextSource.
  • includes/context/​DerivativeContext.php
    A DerivativeContext is an IContextSource implementation which will inherit context from another source but allows individual pieces of context to be changed locally.

/includes/db/[modifier]

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

/includes/diff/[modifier]

This directory contains the standard MediaWiki difference engine. A difference engine computes the difference between two texts. Whether this difference engine is used or some external diff tool, depends on the $wgExternalDiffEngine setting.

  • includes/diff/​DifferenceEngine.php
    The DifferenceEngine class the interface between MediaWiki and whichever difference engine is used. Which difference engine is used depends on the $wgExternalDiffEngine config setting.

/includes/jobqueue/jobs/[modifier]

Files related to the job queue. Each job class for a specific type of job derives from the Job class and has to implement a run() method which does the actual job.

  • includes/job/​JobQueue.php
    Contains the Job class. This is the abstract class to describe a background job. The class also contains static functions for handling jobs (insert jobs in the queue and pop jobs from the queue).
  • includes/job/​RefreshLinksJob.php
    Contains the RefreshLinksJob and RefreshLinksJob2 classes for jobs to update links for a given title. They use class LinksUpdate (defined in /includes/LinksUpdate.php) to update several db tables.

/includes/logging/[modifier]

Some files related to logging the events which happen on a Wiki. This directory was introduced in MW 1.19. Some of the files were already present in olders versions, in the includes/ directory.

  • includes/logging/​LogEntry.php
    Contains the LogEntry interface and some classes implementing this interface to encapsulate log entries. Introduced in MW 1.19.

/includes/media/[modifier]

This directory contains files for handling several media formats, mostly images.

/includes/normal/[modifier]

This directory contains some Unicode normalization routines. See includes/normal/README for more information.

/includes/objectcache/[modifier]

Files related to MediaWiki's caching mechanisms. The files in this directory provide the possibility to store objects in PHP accelerators, in memcached, in a database or in DBA files.

  • includes/objectcache/​BagOStuff.php
    Abstract class to be derived by classes which cache objects in PHP accelerators, SQL database or DBA files. It specifies the methods a cache class must provide, like get(), set(), delete(), etc.

/includes/parser/[modifier]

The MediaWiki parser, which transforms wikitext to HTML, can be found here together with related files. The most interesting files in this directory:

/includes/resourceloader/[modifier]

Files related to ResourceLoader, a JavaScript/CSS delivery optimizing system for MediaWiki.

/includes/search/[modifier]

This directory contains the code to implement the possibility of searching a wiki using one the possible backends.

/includes/specials/[modifier]

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

/includes/upload/[modifier]

Files providing the backend of MediaWiki's file upload feature.

/images/[modifier]

If uploads are enabled in the wiki, files will be put in subdirectories under this directory. See Manual:Image administration#Folders for more details.

/languages/[modifier]

This directory contains files used for localization and internationalization. For a quick overview, see Language in MediaWiki.

  • 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.

/maintenance/[modifier]

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

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

/mw-config/[modifier]

Entry point for the Config script (the helper script that helps setting up a newly installed wiki). The actual code of the installer is located at /includes/installer/.

/resources/[modifier]

This directory contains JavaScript and CSS resources used by MediaWiki, including jQuery.

It also contains binary files like PNG and SVG images, for instance in resources/src/mediawiki/images/: see Manual:Assets.

/serialized/[modifier]

Location for serialized objects (database entries converted into files -- see Serialization for more information). The database tables that contain serialized data are listed at Manual:Serialization.

/skins/[modifier]

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

/tests/[modifier]

Contains various (unit)test related files, including:

  • Parser tests
  • PHPUnit tests
  • QUnit tests
  • browser tests for some core features