Manual:Shared database/fr

Cette page fournit un bref aperçu sur l'utilisation des bases de données partagées dans MediaWiki. La plupart des informations présentes ici devraient fonctionner avec une installation simple de MediaWiki (sans extensions). Toute contrainte des extensions est notée. Notez que cela est conçu autour des bases de données MySQL. La prise en charge de SQLite a été ajoutée en MediaWiki 1.17. La prise en charge de PostgreSQL a été ajoutée en MediaWiki 1.19. Les autres moteurs de bases de données peuvent ne pas prendre en charge les bases de données partagées de cette manière.

Bases
Les bases de données partagées sont configurées par 3 globales principales dans votre fichier  :



Toutes ne vous sont pas forcément nécessaires, cela dépend de vos besoins et de votre environnement.



La configuration la plus simple : une table utilisateur partagée
A shared user table can be used to have multiple wikis that have shared user registrations, so that users need only sign up to one wiki.

Par défaut, $wgSharedTables contient les tables user et user_properties. L'ajout de 'actor' est prévu.



Droits sur la base de données
The MySQL user of the shared wiki must have at least SELECT and UPDATE permissions for the main wiki user tables. If you use different MySQL users for each wiki, you will need to grant additional permissions to the shared wiki user as specified in that wiki's setting. Vous pouvez réaliser cela avec des commandes MySQL similaires à :

This will allow your wiki to read users from the main table, and also update the tables, which happens whenever a user logs in.



Partager les sessions
To share login sessions between your wikis, set to include all subdomains under your root domain. For example, if you have the sites en.example.comfr.example.compool.example.com, set:

Mise à jour
As of MediaWiki 1.21, when upgrading MediaWiki from the web installer, $wgSharedTables must be temporarily cleared during upgrade. Otherwise, the shared tables are not touched at all (neither tables with $wgSharedPrefix, nor those with $wgDBprefix), which may lead to a failed upgrade.

When upgrading from the command line, running the script, you need to use the   parameter for the script to upgrade the shared tables.

In MediaWiki 1.24 the default password type for MediaWiki has been changed from MD5 to PBKDF2, and passwords hashes will automatically be updated as users log in. To prevent this from happening until all wikis are upgraded, set to   on all wikis, and remove it on all wikis when they have been upgraded to ensure a stronger encryption is used.



Partager davantage de tables
You can share tables other than the user table, but be careful when doing so. If a table contains any data specific to one wiki, sharing may cause problems. Note that each of the subsections here assume that you are also sharing the user table. Whenever adding other tables, be sure to either append to the array or include the user table in the new array definition.



Table ipblocks
By sharing the table, you can have "global blocks" so that a block on one wiki will block the user or IP on all other wikis using the shared database.

Mises en garde
Il peut y avoir quelques problèmes mineurs quand la table ipblocks est partagée :


 * The  field is set as the "reason" on Special:Block when blocking a user. When a blocked user sees the "You are blocked" message, this is parsed as wikitext, and links are parsed on Special:BlockList, you will need to make sure when blocking a user that the message makes sense on all wikis.
 * Block logs will not be shared (sharing the table is not recommended).



Table user_groups
Sharing the table will allow you to have global user groups.

Mises en garde

 * As with the block log, the user rights log is not shared.
 * Tous les groupes utilisateurs seront globaux. Vous pouvez contourner cela d'une certaine façon, en personnalisant vos groupes utilisateur. For example, to have admins on one wiki be separate from admins on another, you could do something like the following:
 * Dans la configuration du wiki 1 :


 * Dans la configuration du wiki 2 :


 * To prevent bureaucrats on one wiki from assigning themselves rights on other wikis that they shouldn't have, you can do a similar configuration to the above, but remove the 'userrights' right that allows them to set any group, and use / instead.



Autres tables
This section covers other tables, with less common reasons to share, as well as which tables not to share.


 * The interwiki table contains mostly static data; it may be useful to share if you have many custom interwikis.
 * The site_stats table could possibly be shared, to aggregate data over all your wikis.
 * By default, the table is included in the list of shared tables. If your wikis were started using MediaWiki 1.15 or older, you should probably keep this for backward compatibility, as user preferences will be silently automatically migrated from the user table to the user_properties table. Otherwise, you can remove this from the array to allow users to have different preferences on each wiki (if desired)

Most other tables should not be shared, as they include wiki-specific data, typically connections to pages via a pageid or a namespace/title combination. Ceci comprend (mais n'est pas limité à) :


 * Any of the links tables (pagelinkstemplatelinks, etc.)
 * La table page
 * La table revision
 * The image table (to have a shared media repository, see )

Pour plus de détails, voir



Voir aussi

 * - A different method to have shared user tables. Used by Wikimedia, and probably the easiest option for merging already-established wikis.
 * - an extension that allows IP addresses to be blocked globally, without sharing other databases. The right to globally block users is separated from the normal 'block' right.
 * - An extension that enables global user groups and allows easy management of them via Special:GlobalUserrights.