Manual:Wiki family/ru

Below are instructions for how to set up MediaWiki to host more than one wiki. Multiple wikis located on the same server are called a wiki-family.

Giant switch statement
This will allow you to install more than one wiki on a single server, using the same source code checkout.


 * 1) Upload MediaWiki files to web folder on the webserver.
 * 2) Set up initial wiki as usual. For details, see.
 * 3) After successful installation, move LocalSettings.php into the root directory of your wiki and rename it in such a way to make it easy to track (e.g. LocalSettings_myFirstWiki.php)
 * 4) Repeat step two and three above for each wiki you wish to create, creating a new LocalSettings.php file for each wiki (e.g., LocalSettings_anotherWiki.php, etc.)
 * 5) If two or more separately installed wikis are to be merged to operate out of files of the main wiki, then after renaming and moving each of your LocalSettings.php files to the main wiki folder, change the variable $wgScriptPath in each of the LocalSettings.php files to point to the main wiki's folder.
 * 6) Create a LocalSettings.php file for your global settings, then select one from the two possibilities below:


 * If you have different (sub)domains that link to one directory on your server, use this:


 * To set up multiple domains that point to the same MediaWiki code, you may need to modify your web server and possibly DNS configuration.

See the documentation of your web server and or web host for information on how to do that.


 * If your wikis are on the same domain but different paths (e.g.,   etc), you can use something like this:


 * If you use Short URL with the second case (directory based wikis), you need to check the two directories:, to symlink the sources , and adapt.

It is reccomended to use a different DB for each wiki (By setting a different $wgDBname for each wiki). However if you are limited to a single database, you can use a different prefix ($wgDBprefix) to separate the different installs.

It may also be useful to simply redirect any unrecognized wiki URL to the "main" url, instead of "This wiki is not available. Check configuration."

Updating wikifarm from the commandline
This method requires the $_SERVER["SERVER_NAME"] to be present to run maintenance/update.php - which of course it isn't, from the commandline. This can be overcome by setting an environment variable:

If you were using the subdirectory method, you can use:

Drupal-стиль сайтов
Как и ранее, этот сценарий позволяет установить несколько вики на один сервер, используя тот же исходный код (т.е. один набор файлов MediaWiki) и одну базу данных. Преимущества этого метода в том, что он полностью прозрачен для пользователей и достаточно безопасен с точки зрения каталога изображений.


 * 1) Создайте корневую папку, в которой будут располагаться все файлы MediaWiki. Например,.
 * 2) Установите MediaWiki и дополнительные расширения в подпапку с указанием версии движка (Например,  ).
 * 3) Создайте симлинк на эту директорию. Например,
 * 4) Создайте папку sites для хранения конфигураций и рисунков:
 * 5) Установите вики из папки /code.
 * 6) После успешной установки переместите   в необходимую папку. Например, для сайта http://mysite.com/mywiki, создайте папку mysite.com.mywiki. Например,  . Более подробную информацию смотрите в описании файла settings.php Drupal'а.
 * 7) Если вы собираетесь загружать медиафайлы, создайте для них подпапку в папке вашего сайта. Например,  . Пользователь, под которым работает Apache, должен иметь права на запись в эту папку.
 * 8) Поместите файл Drupal-style LocalSettings.php в корневую папку вашей вики:
 * 9) Модифицируйте LocalSettings.php для каждого сайта так, чтобы он указывал на правильное место:
 * 10) * Сначала закомментируйте, касающиеся переменной, (строки 16-20 в 1.15.3), эта переменная будет установлена в файлом   и будет содержать путь к папке code.
 * 11) * Вставьте следующие строки для возможности загрузки и отображения изображений, например:  and  . Их нужно добавить после вызова файла   (строка 25 в 1.15.3), иначе эти переменные будут сброшены в значения по умолчанию.
 * 12) * Сделать дополнительные изменения по необходимости.


 * 1) Подготовка Apache 2. Пример приведен для сайта wiki.mysite.com
 * 2) * Создайте линк на папку code, если это необходимо. Например,
 * 3) * Создайте конфигурацию для виртуального хоста:

 ServerAdmin me@myserver.com DocumentRoot /home/web/wiki.mysite.com ServerName wiki.mysite.com CustomLog /var/log/apache2/wiki.mysite.log common # Alias for the site to be accessible Alias /mediawiki/code /home/web/mediawiki/code # Alias for Wiki so images work Alias /images /home/web/mediawiki/sites/wiki.mysite.com/images # If you want to password protect your site #  #   AuthType Basic #   AuthName "My protected Wiki" #   AuthUserFile /etc/apache2/htpasswd/users-mywiki #  require valid-user #  


 * 1) Если вы настраивали сайт локально, обновите ваш файл   вписав имена сайтов.

Теперь ваш сайт должен работать. В моем случае, я сделал еще одну копию кода, из которой я устанавливал и обновлял LocalSettings.php и базы данных.

Учтите, что используемая Drupal'ом переменная  не будет установлена, если скрипты обслуживания запущены из командной строки, поэтому данное решение не позволит вам использовать скрипты обслуживания без некоторых модификаций.

Modified Drupal-style method for Ubuntu
A simplified method for multiple wikis and multiple (or nested) subwikis on Ubuntu/Kubuntu that is loosely based on the above method can be found at:


 * Ubuntuguide.org MediaWiki tips

Распределение общих ресурсов между несколькими вики
You want to have some wikis in different languages, sharing the same media-files in another, single wiki.

For example:


 * en.yourwiki.org -
 * fr.yourwiki.org -
 * de.yourwiki.org -
 * pool.yourwiki.org - media-files for all of these wikis (like Commons).
 * As there is already an Interwikilink named commons for Wikimedia Commons, we name our media-files-wiki "pool".
 * Think before being creative; if you call your media-files-wiki something like "media" (e.g. media.example.com), it might collide with internal namespaces and nomenclature for embedded media files ( [[media:file.ext]] ).

On your file system, create a folder for each wiki. Run the install script for each wiki.

This solution duplicates source code. To reduce this duplication and improve cache performance, you may wish to replace the  (≤ MW 1.20.x), ,  ,  ,  ,  ,   (≤ MW 1.17.x),  ,  ,  ,   and   (≥ MW 1.22.x ) directories for non-pool installations with symbolic links to the pool's directories: For example, enter  and then enter''

To do the same in Windows, use

Wiki Configurations
It is imperative, that you modify LocalSettings.php of your different wiki installations right from the start (even before creating the symbolic links), or you will have  piling up in your server's memory. Include the line below into each LocalSettings.php. $wgJobRunRate = 0;

Интервики Interwiki
Now you have to set Interwikilinks between all wikis, by editing their MySQL-Databases (if you prefer, install and use Extension:Interwiki)
 * Table Interwiki
 *  iw_prefix - enter the language-code of the wikis, "de" for German, "en" for English, "fr" for French and "pool" for the mediapoolwiki
 *  iw_url - this is the place for the complete URL to the wikis, e.g. " http://de.yourwiki.org/index.php/$1 " for the German wiki (don't forget the "$1" !).

Now you can link an article to the same in another languages. Adding Hauptseite on your English Main_Page will create the link "Deutsch" (under the Navigation bar) which leads to the Main_Page of the German wiki (Hauptseite). For further information visit Help:Interwiki linking

Note to page Special:Interwiki: (you will see a long table) Add in the German wiki the prefix 'en' and the url http://en.yourwiki.org/index.php/$1 and set the checkbox 'Als lokales Wiki definiert'. Do it in the English wiki vice versa with checkbox 'Forward'. And in both wikis enter a second prefix 'pool' and http://pool.yourwiki.org/index.php/$1 and check the checkbox 'Forward'.

Загрузка
Make sure that folder "images" of the pool-wiki is writable.

It is useful to change the "Upload file"-Link of the language-wikis to point to poolwiki's upload-site. Open the "LocalSettings.php" of each language-wiki and add:

In 1.17, you'll also have to set $wgUploadMissingFileUrl to be redirected to the pool-wiki on red links.

Использование общих файлов
To use poolwiki's files in the languagewikis, open "LocalSettings.php" for each languagewiki and add:

Now you can integrate pool's files with (e.g. ) in the languagewikis.

Описание изображения
In each languagewiki, open (as an admin) the message MediaWiki:Sharedupload-desc-here.

Change the text to something like: This file is stored in our data-pool. For information and description, please visit the

description there. (And note the ':' at the beginning of the line, which stops 'pool' from being included in the interwiki list at the left of the page.)

If you want to output the media-description, stored in the PoolWiki, too, add to the "LocalSettings.php" of the languagewikis:

Общие настройки
If you have multiple wikis, you'll probably want to share similar settings across them all. Here is how to do that. We recommend that you separate your Extension settings into a different file than your other settings, as detailed below. They can be all put into one large file, but it's not as flexible depending upon your specific needs.

Here is an example directory structure if you do all of the following: en/ es/ pl/ ja/ pool/ ExtensionSettings.php WikiFamilySettings.php SharedMediaSettings.php

Extension Settings

 * Step 1
 * Create a file called ExtensionSettings.php with the following contents, and place it in a location similar to the example above.
 * Step 2
 * Edit the LocalSettings.php file of each wiki that you want to use the shared settings, and add the following.
 * Step 3
 * Now just add all the references to your various extensions

Wiki Family Settings
These are settings that you want to apply to the entire wiki family. For example, maybe you want to be able to easily put all the wikis into read-only mode at the same time. You can also store the username/password for the database(s), if they are all the same. Additionally, you could control user permissions across your entire wiki from this one file.

Note: If you use a Images/Media commons or pool, we recommend that you do not put these settings in the WikiFamilySettings.php file. That information only applies to every wiki in your wiki family other than your repository. We recommend putting it in a separate file.

Shared database tables
See Manual:Shared database for instructions on setting up shared database tables.

Итоговое минималистское решение
Итоговое минималистское решение состоит из символьных ссылок, $ ls -og lrwxrwxrwx 1 16 2008-11-03 06:29 aaa.example.org -> mediawiki lrwxrwxrwx 1 16 2008-11-03 06:29 bbb.example.org -> mediawiki lrwxrwxrwx 1 16 2008-11-03 06:29 ccc.example.org -> mediawiki Посмотрим реальный пример. В реальной ситуации у вас будут, вероятно, незначительные отличия в именах сайтов и баз данных, которыми Вы управляете. Примечательно, что мы и поныне отдельно подготавливаем задачи, связанные с базой данных, например php update.php. (Вышеуказанный код должен определить к каким вики-проектам обращается update.php.) Обновление просто, если Вы используете SVN (download from SVN). (Надеюсь нет больше кода (code), который предполагает, что есть только один Вики-проект на диске...)

Изображения
Если вы не позволяете загрузку или позволяете только для вашего пула wiki, Вы должны создать отдельные каталоги изображений и указать их псевдонимы в вашей vhost конфигурации:, а также в aaa.example.org's vhost: . Таким же образом для bbb и ccc.

Однако вместо этого можно предпочесть альтернативную простую установку Manual:Image Administration, где *.example.org/images/ только указывает на ту же самую директорию. В качестве примера: *.example.org/$wgDBname/images/.

Adding new wikis
To add a wiki to a production
 * 1) add its configuration to your web server
 * 2) temporarily comment out the  check of config/index.php and then run it
 * 3) merge the config/LocalSettings.php produced into LocalSettings.php
 * 4) add some pages

Removing old wikis
To remove a wiki from a production
 * 1) remove its configuration from
 * 2) web server
 * 3) LocalSettings.php
 * 4) DROP DATABASE

Wikimedia Method
Another option is using the method that the Wikimedia Foundation uses. The rough steps are listed below. This method isn't for the faint of heart, but it has fairly good results, as can be seen by the success the Wikimedia Foundation has had by using this :-)  Configure a template copy of MediaWiki through the online configuration wizard. Edit the Main Page if you want a default main page for every wiki you create on your farm. After that, export your database with mysqldump, phpMyAdmin, etc. Save this on your server in the maintenance/ directory as something like . Now, write up a few quick scripts to create a new wiki. In a gist, you'll need to add it to a list of wikis, which can be flat-file based or MySQL/SQLite based, and then import the template database dump back into the database under the name of a new wiki. Use a standard suffix after the new database name (i.e. if the wiki is meta.yourdomain.net, then you might choose metawiki as the database name). In your configuration file, add something like this, fixing the database prefix and your domain as necessary:  Configure your DNS with a wildcard A record, and apache with a server alias (like ) and you should be in business.</li> </ol>

The script maintenance/update.php can be included from a another php script, update_farm.php for example, and this outer script will set the various SERVER values that are needed by your LocalSettings.php to set the correct $wgDBname: and the command line for updating meta.yourdomain.net is, from your unique mediawiki directory: php update_farm.php meta.yourdomain.net Your unique LocalSettings.php (which usually consists in a few lines including a CommonSettings.php not directly accessible from the server) decodes the variable meta and will set the $wgDBname accordingly.

The DOCUMENT ROOT directory (similar to the value set in your httpd.conf) can also be used in your CommonSettings.php in order to have more flexibility, like using a test server.

You'll also need to fix the upload directories unless you want every wiki to use the same files. As said above, this is probably one of the hardest methods to do, and it requires more technical experience, but it can give really good, clean results.

Wiki Farm Extensions
There are several MediaWiki extensions that attempt to simplify hosting of several wikis by using just one code base:
 * Extension:Farmer
 * Extension:WikiFarm
 * Extension:Simple Farm