How to become a MediaWiki hacker

Other languages: 日本語 (ja) ...Translate this page!

This page will try to collect information about MediaWiki's development process, and to answer questions by neophyte developers. If you plan to help us code, but don't have the necessary skillset yet, this is a good place to start.

First, some crucial links:


 * The Wikipedia-code web page contains general information about development
 * The Wikipedia SourceForge Project page allows you to check out the code and to report bugs. Note that we do not use SourceForge's patch tracker (if you don't know what patches are, see below).
 * Mailing lists: wikitech-l for development, mediawiki-l for support, mediawiki-cvs for CVS notifications
 * MediaWiki architecture has more documentation!

Operating systems
The MediaWiki software is written in PHP and uses the MySQL database. Both have been ported to a variety of operating systems, including, but not limited to, most Unix variants and Microsoft Windows. It is therefore possible to install and use Wikipedia under both systems. You will likely get better assistance if you are using a Unix, though, as most developers prefer to use tools from the Unix world (MySQL + PHP) in a Unix environment.

If you plan to switch to a Unix, there are a variety of free (open source) Unix variants available. Most popular among them is Linux, which is available in prepackaged form and reasonably easy to install. In order to get to know the Unix world, the Rute Tutorial is highly recommended. So are the Linux cookbook for day-to-day tasks and the Linux documentation project for more complex problems.

The PHP programming language
If you have no knowledge of PHP (PHP stands for "PHP: Hypertext Preprocessor") but know how to program in other object-oriented programming languages, have no fear, PHP will be easy for you to learn.

If you have no knowledge of PHP or other object-oriented programming languages, you should familiarize yourself with concepts such as classes, objects, methods, events, inheritance.

If you have no knowledge of any programming language, PHP is a good language to start with, as it is reasonably similar to other modern languages, although it is specific in the way it is executed.

Unlike most programs, PHP scripts are typically not run from the command line or a window manager. Instead, a PHP script is executed when you request a file with the ".php" extension (among others) from a webserver. As you do that, the web server, in our case Apache, calls the PHP interpreter (which may be built into the webserver), interprets the PHP file and returns the result to your browser. The PHP file can contain both regular HTML and PHP code, which makes it relatively simple to add dynamic functionality to a static webpage.

Related links:


 * PHP tutorial (available in many different languages)
 * The PHP manual (available in many different languages)

SQL and MySQL
Wikipedia currently uses MySQL as the database backend. Make sure MySQL support is compiled into PHP!

We're also trying to make the wiki work with other database backends, particularly postgresql, out of performance and portability concerns.

Installing MediaWiki
On how to get the sources from CVS see Wikipedia:PHP script.

You'll find cryptic instructions in the INSTALL file in the source. Try to follow them. You could also try checking out MediaWiki_User's_Guide:_Installation.

If you want to set up a local copy of the existing database to play with, first create an empty database with MySQL and run the 'createdb.php' script in the 'maintenance' subdirectory (make sure it's configured appropriately!). Note that the maintenance scripts include files from the main source directory; either set up an include directory for PHP or just copy the files in.

Then, once you've got the SQL dumps for the language you want, import them like so:
 * Linux
 * gzip -dc cur_table.sql.gz | mysql -u wikiadmin -padminpass wikidb
 * gzip -dc old_table.sql.gz | mysql -u wikiadmin -padminpass wikidb
 * cd maintenance ; php rebuildlinks.php

unzip the file
 * Windows (may need -u wikiadmin -padminpass wikidb as above)
 * mysql < cur_table.sql
 * mysql < old_table.sql
 * cd maintenance ; php rebuildlinks.php

Rebuilding the link tables may take a long time, particularly if you've installed the English database, which is kinda big. (Note also that you can skip the old table if you wish.) See Database layout on what rebuilding.php is good for.

Note that if you want to create a public mirror of Wikipedia, this probably isn't the best way to go about it. If you do set up a mirror this way, please tweak the code to note that you're looking at a mirror and include links back to the main site.

The Wikipedia codebase
...

Your first feature
...

See also: Development policy