Multiple multiple Mediawiki wikis from a single install
Since I prefer to use the FreeBSD ports tree to install and update software on my server, it is a pain having multiple installs of different versions of the same software scattered across different directories. My goal has been to run all web-based software from a single code base, yet I want the data maintained by these multiple wikis to be separated.
Here is how this can be done in Mediawiki, allowing for separate wikis reading from separate databases:
- Make a copy of a virgin Mediawiki database, perhaps calling the database “wikidb_template” (note, you’ll have to keep the schema stored within this DB up-to-date across Medawiki releases, this is explained below…)
- Make a copy of Mediawiki’s LocalSettings.php file. Name it something like “LocalSettings-mywiki.php”, where “mywiki” is the name of your wiki.
- Create symbolic links from your Mediawiki codebase to the directories you wish to be served by your Mediawiki wiki
- Replace the original LocalSettings.php file with something like the following, matching “mydomain.com” with your domain, and the path names to paths matching your symbolic linked directories:
if (preg_match('/(www\.)?yourdomain.com/', $_SERVER['SERVER_NAME']) && preg_match(’/^\/mywiki/’, $_SERVER['REQUEST_URI'])) {
// settings file for wiki in path starting with “/mywiki”
include ‘LocalSettings-mywiki.php’;
}
elseif (preg_match(’/(www\.)?yourdomain.com/’, $_SERVER['SERVER_NAME']) && preg_match(’/^\/anotherwiki/’, $_SERVER['REQUEST_URI'])) {
// settings file for wiki in path starting with “/anotherwiki”
include ‘LocalSettings-anotherwiki.php’;
} - Edit each LocalSettings file to modify the database connection information to match the database credentials you have established for each wiki
- Create another LocalSettings file pointing to your wikidb_template database. This way, you’ll be able to update the schema to your virgin database as necessary using the Mediawiki web interface updater
You can leave a response, or trackback from your own site.
[...] Documenting the technology that drives NetMusician « Multiple Mediawiki wikis from a single install [...]