Topic on Project:Support desk

How can I set up multi-wiki by one Mediawiki source code?

5
Deletedaccount4567435 (talkcontribs)

Fore example I want to set up 3 wikis.

en.moywiki.org
zh.moywiki.org
ja.moywiki.org

Can I install the wiki source code in home/wiki/. Then put separate config in different directory. Different wiki will use different database but same source code.

Will this be possible?

Now I can let en.moywiki.org direct to /home/en, but I can't make it work.

Allen4names (talkcontribs)
Bawolff (talkcontribs)

Yes. There's a variety of ways to do this.

Wikimedia uses a heavy-weight approach known as $wgConf. It allows setting up different per-wiki configurations. However, this can be a little confusing to set up, and the documentation for $wgConf is a tad sparse.

Note, if you want to use certain cross wiki extensions (such as Extension:GlobalUsage), you may need to go the $wgConf route.

Another way that is more common in really small cases, is to have three separate directories all containing symlinks to the wiki code, but with each directory containing its own LocalSettings.php.

You can even have just one directory with wiki code, and the LocalSettings.php file, but have an if statement in the LocalSettings.php file. Something like (haven't tried that, so probably made a typo somewhere)

if ($_SERVER['SERVER_NAME'] === 'fr.mywiki.com' ) {
 $wgArticlePath = 'blah';
 $wgScriptPath = 'blah';
 $wgDBName = 'foo;
 // and so on
} else if ...

You may also want to read about manual:$wgSharedTables, manual:$IP, and manual:Wiki family

Deletedaccount4567435 (talkcontribs)

Thank you!

I don't want to put 3 wiki in one directory. That will make it difficult to maintain in further.

Now we are running the zh version in a VPS which is short in disk space.

single localsetting.php will cause some cache problem.

Now all the tutorial that I found are talking about 3 different mediawiki using CommonSettings.php . I want to use single set of mediawiki code+3different localsetting.php which could let me change some mediawiki source code for all wiki easily.

Bawolff (talkcontribs)

There should be no problem with doing that. Just have to make sure all the different entry points resolve to the same mediawiki directory.

>single localsetting.php will cause some cache problem.

What do you mean?

Now all the tutorial that I found are talking about 3 different mediawiki using CommonSettings.php . I want to use single set of mediawiki code+3different localsetting.php which could let me change some mediawiki source code for all wiki easily.

You could have one LocalSettings.php file, which based on a switch statement loads one of LocalSettingsEn.php, LocalSettingsZh.php or LocalSettingsJa.php depending on what site is visited. Most setups recomend putting some settings in a common settings file (otherwise you have duplication) but you can certainly just have a bunch of totally independant settings files for each wiki.

Reply to "How can I set up multi-wiki by one Mediawiki source code?"