Manual:Wiki family/fr

Voici les instructions sur la façon de configurer MediaWiki pour accueillir plus d'un wiki. Plusieurs wikis situés sur le même serveur sont appelés wiki-family.

Déclaration d'un aiguillage géant
Cela vous permettra d'installer plus d'un wiki sur un seul serveur, en utilisant le même code source de commande.


 * 1) Télécharger les fichiers MediaWiki dans votre dossier Web sur le serveur.
 * 2) Mettre en place le wiki initial comme d’habitude. Pour plus de détails, voir.
 * 3) Après une installation réussie, déplacez le fichier  dans le répertoire racine de votre wiki et renommez-le de manière à le retrouver facilement (par exemple LocalSettings_myFirstWiki.php)
 * 4) Répétez l’étape deux et trois ci-dessus pour chaque wiki que vous souhaitez créer, générant un nouveau fichier LocalSettings.php pour chacun d’eux (par exemple, LocalSettings_anotherWiki.php, etc.)
 * 5) Les wikis installés séparément doivent être fusionnés pour fonctionner sur un site unique. Après avoir renommé et déplacé chacun de vos fichiers LocalSettings.php dans le dossier principal, modifiez la variable  dans chacun d’eux pour pointer vers le wiki maître.
 * 6) Créez un fichier LocalSettings.php pour vos paramètres globaux, puis sélectionnez l’une des deux possibilités suivantes :


 * Si vous possédez différents (sous-) domaines qui pointent vers un répertoire sur votre serveur, utilisez ceci :


 * Pour paramétrer plusieurs domaines qui pointent vers le même code MediaWiki, vous devrez peut-être modifier votre serveur web et éventuellement la configuration DNS.

Consultez la documentation de votre serveur Web ou de votre hébergeur pour obtenir des informations sur la façon de pratiquer.


 * Si vos wikis sont sur le même domaine, mais avec des chemins différents (par exemple,  , etc.), vous pouvez utiliser ce modèle :


 * Si vous utilisez une URL courte avec le second cas (des wikis à base de répertoire), vous devez vérifier les deux répertoires :, créer un lien symbolique des sources , et adapter.

Nous recommandons d’utiliser une base de données différente pour chaque wiki (en définissant un nom unique pour chacun d’eux). Toutefois, si vous êtes limité à une seule base de données, vous pouvez utiliser un préfixe différent pour séparer les différentes installations.

Il peut également être utile de simplement rediriger l’URL du wiki non reconnu vers l’URL "principale", a la place de "Ce wiki n’est pas disponibles. Vérifiez la configuration."

Mise à jour de la ferme Wiki en ligne de commande
Cette méthode nécessite que $_SERVER["SERVER_NAME"] demeure en fonction pour exécuter maintenance/update.php, ce qui, bien sûr, ne se pratique pas à partir de la ligne de commande. Vous pouvez effectuer cette mise à jour en définissant une variable d’environnement :

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

Drupal-style sites
As above, this setup allows you to install more than one wiki using different databases on a single server, using the same source code. This setup has the advantage of being completely transparent to users and reasonably secure in terms of the images directory.


 * Create a base directory to contain all your MediaWiki files e.g..
 * Install MediaWiki and additional tools as usual to a version-declaring subdirectory(e.g., ).
 * Link the version-declaring directory to a code directory. e.g.,
 * Create a sites directory to contain our images and settings:
 * Setup the wiki as normal from the /code directory.
 * After successful installation, move LocalSettings.php into a sites directory that will be a match when the site is checked. For example, to capture http://mysite.com/mywiki, one would create the directory mysite.com.mywiki. e.g., . See the Drupal's settings.php file for more information on this.
 * If you intend to use media files, create an images directory in your site directory. e.g., . Make it writable as necessary.
 * Place the Drupal-style LocalSettings.php file in your main directory:
 * Modify the LocalSettings.php of each subsite to point to the right places:
 * First comment out the code relating to, (lines 16-20 in 1.15.3) as this is set to the code directory by.
 * Next insert the following two lines to ensure that image files are accessible, e.g.:  and  . These need to be put somewhere after the call to   (line 25 in 1.15.3), as the variables will otherwise be reset.
 * Make further modifications as required.


 * Prepare your Apache 2 installation. Example site: wiki.mysite.com
 * Create a link to the code directory, if required e.g.
 * Create an appropriate VHost configuration:

 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 #  


 * If you are setting the sites up locally, update your  file with the site names.

The site should now work. In my case, I made another copy of the code from which to install and update my LocalSettings.php and databases.

Note that  in the companion Drupal code is undefined when running maintenance scripts from the command line, so this solution does not permit the use of maintenance scripts without some modification.

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

Multiple wikis sharing common resources
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
Maintenant vous devez paramétrer les liens interwiki entre tous les wiki, en éditant leurs bases de données MySQL :
 * Table interwiki
 * iw_prefix - entrez le code de la langue des wikis, "de" pour l'allemand, "en" pour l'anglais, "fr" pour le français et "pool" pour le mediapoolwiki
 *  iw_url - ceci est l'endroit où doit apparaître l'URL complète des wiki, par exemple  pour l'allemand (n'oubliez pas le "$1").

Maintenant vous pouvez lier un article à son équivalent dans d'autres langues. Ajouter  sur une page crée un lien interwiki "Deutsch" (sous la boîte à outils) vers la page Hauptseite du wiki en allemand. Pour plus d'informations, regardez Help:Interwiki linking/fr.

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'.

Téléchargements
Soyez sûr que le répertoire "images" du poolwiki est autorisé à l'écriture.

Il est pratique de changer le lien "Copier sur le serveur" des wikis pour pointer vers le wiki pool. Ouvrez le fichier LocalSettings.php de chaque wiki et ajoutez :

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

Utiliser des fichiers partagés
Pour utiliser les fichiers du poolwiki dans les autres wikis-langue, ouvrez le fichier LocalSettings.php de chaque wiki-langue et ajoutez :

Vous pouvez maintenant intégrer les fichiers du poolwiki avec par exemple dans les wikis-langue.

Description des images
Dans chaque wiki-langue, ouvrez (en tant qu'admin) le message MediaWiki:Sharedupload.

Changez le texte avec la forme : Ce fichier est enregistré sur notre poolwiki. Pour des informations sur l'image et la description, visitez sa

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.)

Si vous voulez afficher la description du média, enregistrée sur le poolwiki également, ajoutez au LocalSettings.php de chaque wiki-langue :

Shared Settings
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.

Ultimate minimalist solution
The "ultimate minimalist solution" consists of symlinks; $ 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 Let's see a real example of. In real life we must deal with the slight differences in the names and databases of the sites we manage. Note we still individually do database related tasks, e.g.,  (The above code should detect which wiki's update.php you are referring to.) Upgrading is simple if you download from Git. (Hopefully there is no more code that assumes there is only one wiki on the disk...)

Images
Unless you do not allow uploads or allow them only for your pool wiki, you will need to create separate image directories and alias them in your vhost configuration:, and in aaa.example.org's vhost: . Same for bbb and ccc.

However you may instead just prefer , where *.example.org/images/ just point to the same single directory. Or one could use e.g., *.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 .</li> 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).</li> In your configuration file, add something like this, fixing the database prefix and your domain as necessary: </li> 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