Manual:Code/Historical
From MediaWiki.org
NB: This page is extremely out of date, and should be used for very rough guidance only. A more recent overview of the MediaWiki architecture is at Manual:Code.
There is some documentation (in various states of decay) in the CVS source's docs sub-directory. There is also a nice load of documentation generated from comments.
Contents |
[edit] Initialization
The first script called is index.php which sets up various global objects and determines what action needs to be taken.
[edit] Settings
- includes/DefaultSettings.php
- basic settings, not adapted to the individual site
- LocalSettings.php
- settings for this specific site (project/language) - it is generated automatically by the install procedure, and can be customised by copying and altering elements from DefaultSettings.php, which it will override.
If running a multi-wiki site, you may also wish to make a CommonSettings.php which can be included from each individual LocalSettings.php to minimize the amount of cut-n-paste you do.
[edit] Languages
See also MediaWiki localization. These files are contained in the "languages" sub-directory.
- Language.php [1]
- English interface messages, which are also the fallback for other languages
- LanguageXX.php
- many files with XX being the language code (ISO 639-1) specified in LocalSettings.php
Note that once the software is installed, the interface messages are actually stored in the database, in the "MediaWiki namespace", so changes to LanguageXX.php will (in general) have no effect.
[edit] Basic code
The core parts of the code can be found in the "includes" sub-directory.
- Article.php
- manages an article, with contents etc. (Note that the
Articleclass is not a fully independent object. It's dependent on a lot of global variables: in particular it's tied to theTitleobject $wgTitle) - HTMLFileCache.php
- deals with the file cache
- DatabaseFunctions.php
- database access functions
- DifferenceEngine.php
- makes the pretty diffs
- GlobalFunctions.php
- often used functions that don't match any category known to mankind
- LogPage.php
- MagicWord.php
- manages the (localisable) "magic words" in wiki-text, such as "#REDIRECT" and the various image display key-words
- Namespace.php
- OutputPage.php
- takes wiki and HTML (from
Parser.php) and makes a web page out of 'em (with the aid of an appropriate Skin class) - Parser.php
- it might not be a fancy LALR or recursive descent parser, but this set of global regular expression replacements turns the wikitext into HTML, as well as spotting things like links that need to be added to the database on save. Highly tied in with the Skin classes and
OutputPage.php - SearchEngine.php
- does the searching
- Title.php
- manages page titles, with namespaces, database IDs, etc.
- User.php
- user related functions
[edit] Skins
The skins system has changed several times over recent versions of MediaWiki, and generally proves rather confusing. Basically, includes/Skin.php defines a generic class, which is essentially the old default skin (now known as "Classic"), but also deals with actions basically common to all skins, like the HTML of an inline image. Sub-classes, defined in files called SkinFoo.php over-ride enough of this to give a different look, and provide varying degrees of customisability (using PHPTAL templates, CSS, etc)
[edit] Special pages
All the pages in the "Special" namespace are actually defined as separate scripts, also in the "includes" sub-directory. They all inherit from SpecialPage.php, which also defines the list of available pages.
- SpecialAncientpages.php (pages that have not been edited for an eternity and probably have produced some crude oil already)
- SpecialAsksql.php (for submitting SQL queries via web page: sysops and admins only!)
- SpecialBlockip.php
- SpecialBooksources.php
- SpecialCategories.php
- SpecialContributions.php
- SpecialDebug.php
- SpecialEmailuser.php
- SpecialImagelist.php
- SpecialIntl.php
- SpecialIpblocklist.php
- SpecialListusers.php
- SpecialLockdb.php
- SpecialLonelypages.php (pages that no other page links to: "orphaned" pages)
- SpecialLongpages.php (well, the longest pages: they need probably breakdown into smaller ones)
- SpecialMaintenance.php (misc maintenance functions, usually offline due to MiserMode&trade:)
- SpecialMovepage.php (to move a page and its talk page)
- SpecialNeglectedpages.php
- SpecialNewpages.php (the latest creations by our fellow wikipedians)
- SpecialPopularpages.php (obsolete now that the internal view counter is turned off)
- SpecialPreferences.php (user preferences page)
- SpecialRandompage.php (random page: needs "redirect.phtml" for redirecting, I think)
- SpecialRecentchangeslinked.php
- SpecialRecentchanges.php (displays recent changes)
- SpecialShortpages.php (the opposite of long pages...)
- SpecialSpecialpages.php
- SpecialStatistics.php
- SpecialUndelete.php
- SpecialUnlockdb.php
- SpecialUnusedimages.php
- SpecialUpload.php
- SpecialUserlogin.php
- SpecialUserlogout.php
- SpecialVote.php
- SpecialWantedpages.php
- SpecialWatchlist.php
- SpecialWhatlinkshere.php

