User:Ymmotrojam/Reusing MediaWiki code

Of course the ultimate wiki family for a MediaWiki admin, would be one where the actual code can be shared. Now it has been possible to share style sheets, the user table, and other useful things for a while now, but where it gets tricky is sharing the actual PHP files. Basically the goal is to reduce each wiki directory in the wiki-family, to only a LocalSettings.php, index.php, an images directory, and a maintenance directory.

There are obvious advantages to sharing the actual PHP code. Although you would still need to upgrade each wiki database individually, you would only need to update the wiki code once! That is a huge time saver. Also, a shared code directory lessens the size and the amount of time a backup takes. A shared code directory would also mean less work for caching programs like eAccelerator, which cache PHP scripts. If you've tried shared extensions before and found strange errors, a shared mediawiki code directory should also get rid of some of those. Some extensions just don't like to be anywhere else but in one single wiki, and this technique tricks them to think they are in one wiki when it is really an unspecified amount.

Step 1:
$IP = '/direct/path/to/the/code/mediawiki'; set_include_path(get_include_path.PATH_SEPARATOR.$_SERVER['DOCUMENT_ROOT'].'/mediawiki');
 * A: Get MediaWiki installation from svn.wikimedia.org
 * B: Manual:$IP;
 * C: Set the includes directory in index.php (of the fresh wiki installation that was just downloaded)

Step 2: Some minor changes to the wiki code are required

 * A: Remove the "./"

Editing /includes/WebStart.php

 * You may get some file-not-found errors from within this file. It's simply a matter of pointing them to the shared directory.

Editing /includes/SkinTemplate.php

 * Note to self: Talk about the "Cannot redeclare class" error