Manual:LocalSettings.php/fr

Le fichier permet la configuration des variables locales cf: configuration settings (basé sur le fichier " ") de l'installation du MediaWiki. Vous devriez prendre votre temps pour examiner les paramètres dans ce fichier. Le fichier est habituellement généré par le programme d'installation accessible via une page Web MediaWiki, mais vous pouvez modifier certains des paramètres, éventuellement de concert avec les paramètres d'Apache.

Modifier un paramètre signifie généralement de modifier la valeur d'une variable PHP. Vous pouvez d'abord vous familiariser avec la syntaxe PHP avant aller de l'avant. En règle générale, gardez à l'esprit que les variables PHP sont accessibles en préfixant de caractère "$" devant le nom de la variable; de nombreuses variables sont tout simplement réglé soit  ou.

Vos modifications prendront effet immédiatement après l'enregistrement du fichier: il n'est pas nécessaire de faire manuellement un "restart" pour quoi que ce soit (apache ou autre). Dans certains cas, vous pourriez avoir besoin de vider le cache de votre navigateur pour voir des changements.

La valeur "par défaut" de nombreux autres paramètres sont placés dans includes/DefaultSettings.php, qui n'ont pas besoin d'être modifié. Si la variable que vous souhaitez modifier n'est pas déjà mentionné dans votre LocalSettings.php, copiez la ligne appropriée de DefaultSettings.php et modifier la de manière appropriée. DansLocalSettings.php vous pouvez ajouter de nouvelles lignes à la fin. Toutes ces lignes devraient certainement apparaître en dessous de la ligne : 'require_once("includes/DefaultSettings.php"); '

Dans le fichier, il peut également avoir plusieurs lignes tels que 'require_once("extensions/extension. Php ");, qui font le lien vers d'autres d'extension extensions activée sur le wiki. Ces extensions peuvent exiger la définition des valeurs de plusieurs variables dans LocalSettings.php, consultez la documentation de l'extension pour des instructions complémentaires. Une liste des extensions est disponible sur Extension Matrix.


 * Ne placez pas les extensions avant la ligne : require_once( "includes/DefaultSettings.php" );, qui comporte une fonction de configuration qui vide les tableaux des extensions, ce qui aurait pour conséquence de ne pas avoir d'extensions à installer, et probablement rendre votre wiki inaccessible.
 * Ne placez pas les extensions avant la ligne : require_once( "includes/DefaultSettings.php" );</tt>, qui comporte une fonction de configuration qui vide les tableaux des extensions, ce qui aurait pour conséquence de ne pas avoir d'extensions à installer, et probablement rendre votre wiki inaccessible.

Votre version de LocalSettings.php</tt> ne peut pas se terminer par une balise PHP de fermeture : ?&gt;</tt>. Ceci est fait volontairement, car il empêche les gens d'ajouter de nouvelles informations après cette balise. PHP fonctionne très bien sans balise de fermeture.

Voir l'index des paramètres de configuration et les commentaires inclus dans les fichiers de paramétrage ainsi que l'aide pour connaître ce que peuvent faire chacunes des variables. Une courte liste des variables les plus importantes, ainsi que la plupart des fonctionnalités les plus courantes, est ci-dessous.

Si vous avez un wiki sur MediaWiki wiki farm que vous n'avez pas accès en écriture (peut-être même pas accès en lecture) sur la fichier LocalSettings.php (voir par exemple ). Wiki farm company n'est peut être pas disposés à faire les changements que vous désirez. Il veut peut-être garder la plupart des réglages identiques sur tous les wikis de Wiki farm.

Include path
La variable $IP (include_path) contient le chemin du fichier local pour l'installation de base de votre wiki. Assurez-vous d'indiquer le chemin complet qualifié du fichier. Ne pas inclure une barre oblique à la fin du chemin.

Le fichier DefaultSettings.php est chargé à partir du répertoire désigné par la variable d'enquête.

Nom du site
La variable $wgSitename contient le nom de votre wiki. Ce nom sera inclus plusieurs fois dans tout le système. Par exemple, le Wikipedia slogan «Un article de Wikipédia, l'encyclopédie libre." Fait usage de ce paramètre.

Langage du site
La variable $wgLanguageCode contrôle la langue de l'interface de votre wiki. Alors que les utilisateurs peuvent changer la langue qu'ils voient dans leur preferences, cette variable définit la langue par défaut que tous les utilisateurs anonymes, voir la plupart des utilisateurs enregistrés.

Déclinaison du nom du site
Certaines traductions de l'interface sont sensible au changement du nom du site. Vous pouvez définir les formes appropriées du mot dans les variables $wgGrammarForms.

Script path
$wgScriptPath est le préfixe de l'URL d'accès au script principal MediaWiki, qui est la pièce centrale (par intérim) du code de MediaWiki. Ce paramètre doit correspondre Apache settings, en particulier si vous utilisez les règles Apache rewrite.

Server name
$wgServer peut être utilisé pour remplacer éventuellement la détection automatique. Lorsque le wiki est accessible à partir de différent moyens : soit en local (via  ou  ) soit à partir d'un réseau local (via par exemple  ) soit d'Internet (via URL), les notifications par e-mail et quelques autres messages calculé serait normalement transmis avec les différentes URL. L'utilisation de  remplace la détection et le nom du serveur.

Si www.example.com est l'adresse du serveur de votre wiki visible depuis internet, ajoutez cette ligne tel que

La variable magic word  peut être utilisé dans les pages du wiki; c'est de la même valeur que.

Script name
$wgScript is the name of the main (index) MediaWiki PHP script, named index.php</tt> by default. Changing the script name is probably not a good idea. However, if you feel the urge to do so, this is the place to make your changes. Make sure you know what you are doing.

Redirect script name
The $wgRedirectScript variable specifies the URL path to the redirect script which handles redirects in MediaWiki. This setting is similar to wgScript as you can configure the exact name of the script. As mentioned above, this is probably not a good idea unless you really know what you are doing.

Article path
$wgArticlePath is the path to use when accessing a page in MediaWiki. The path should contain the path to the main script (usually making use of ) and use the $1</tt> placeholder for the article name.

If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust  to address the right path. Note that wgArticlePath is used to construct URLs from within MediaWiki. If you make a mistake here, internal links will show up incorrectly while you still may be able to access the main page by specifying the correct URL manually. See Manual:Short URL for more information on URL configuration.

Typical values are:

Stylesheet location
Use the $wgStylePath variable to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located. The $wgStyleDirectory variable should point the same place, but note that this is a local file system path for use in internal scripts accessing the file system.

Upload location
The upload directory is the place where files uploaded by the users are stored. The $wgUploadPath variable specifies the URL path, the $wgUploadDirectory points to the local file system path.

Logo
The $wgLogo variable specifies which graphical logo is displayed in the top left corner of all mediawiki pages.

Add the following two lines to  (below the "require" statements):

This replaces the default logo in the /wiki/skins/common/images/ directory.

Another option is to direct the  variable to the Upload Directory to be able to exchange the logo by updating uploaded files.

is usually.


 * Note that in the example given, the  points to   with the first part being defined by  . Make sure you have both correct, or   will not point to where you think it's pointing.

Contact info
The $wgEmergencyContact variable is the e-mail address of the user to contact when things happen. This e-mail address is used to send internal bug reports to. As an administrator, you want to include your e-mail address here.

The $wgPasswordSender variable is the e-mail address where e-mail gets sent from, when passwords are sent out to users who have forgotten their passwords. Choose an address people can reply to in case of trouble or confusion.

Database settings
MediaWiki needs access to the database (currently either MySQL or PostgreSQL) to store pages, modifications, user information, and a lot more things.

The $wgDBserver contains the hostname where the database is hosted on. In most cases this will be just "localhost" as the database is run on the same system, but for distributed installations, you need to fill in the fully qualified domain name of the computer running the database.

$wgDBname is the database name of the database to be used by MediaWiki. A single MySQL or PostgreSQL installation can store more than one database and you can even run many MediaWiki installations on a single server. Make sure you have stated the correct database name here and use different database names for different wiki installations on the same database server.

The $wgDBuser and $wgDBpassword variables contain the login name and password to be used by MediaWiki to access the database. Make sure the specified user has the proper access rights to be able to manipulate the wiki's table on the database server.

Security
Keep in mind that the LocalSettings.php permissions should not allow other users to view this file as it contains security-related data, including your database user password. chmod 700 or otherwise set the permissions to something that provides security from public access. Additionally, the database user only needs to have SELECT, INSERT, UPDATE and DELETE permissions for the database. See also AdminSettings.php which is a MySql user that has superuser database permissions to run the maintenance scripts.

User rights
The $wgGroupPermissions is an associative array, controlling permissions for creating and editing pages for your different user groups. In this array, custom permission levels can be created, and permission levels for the different user groups can be set. See Help:User rights for more information about the different permissions and user groups available.

Force capital links
By default, no page name can start with a lowercase Roman letter: in an attempt to do so the first letter is converted to uppercase; if a link target, included page, image or category is specified with a name starting with a lowercase letter, the actual target etc. is the page starting with the corresponding capital.

Alternatively page names can start with a lowercase letter, in addition to the possibilities of starting with a capital, a digit, etc. For that you must adjust the $wgCapitalLinks variable. Setting it to false allows lowercase characters, true chooses the default behaviour.

Enabling subpages
Subpages are enabled on a per-namespace basis using the $wgNamespacesWithSubpages variable. For example, to enable subpages in the main namespace:

Image uploads
Before users are allowed to upload files to the MediaWiki system, you have to enable that feature. Make sure the Upload Directory is properly configured and writeable by the Apache web server process. Then set the $wgEnableUploads variable to true to allow uploading in the web user interface.

i.e. Here's some example code from includes/DefaultSettings.php to put in LocalSettings.php. If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working ImageMagick installation. Set the $wgUseImageResize and $wgUseImageMagick variables to true once you have installed and tested ImageMagick on your system. Make sure the $wgImageMagickConvertCommand variable points to the proper location of the convert</tt> command of your installation and that the command is executable by the web server process.

Also, you may want to modify the list of accepted extensions, which is stored within the $wgFileExtensions array:

In case you run into trouble with ImageMagick, and obtain the following error message:
 * Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506</tt>

Try adding the following line to LocalSettings.php: $wgMimeDetectorCommand = "file -bi";

See also: Manual:Configuring file uploads, Manual:Mime type detection, and Manual:Image Administration

LaTeX inline equations
In order to render mathematical formulae in LaTeX, you need a working LaTeX installation on your system. Set the $wgUseTeX variable to true to enable that feature. Also make sure the $wgMathPath, $wgMathDirectory and $wgTmpDirectory are set properly, but you might want to go with the default values unless you have a very good reason to change it.

Interwiki support
InterWiki support is built into MediaWiki but you need to configure the prefix to be used for your internal links. This prefix is usually the same as $wgSitename, but in case you need to change that, you set the $wgLocalInterwiki variable to the preferred name.

Language of user interface
MediaWiki allows for a variety of localized user interfaces languages instead of the english default. If you want to run your wiki in a non-English language, set the $wgLanguageCode variable to the proper language code (e.g. "de" for German, "es" for Spanish, etc.)

You may use any of the languages found in the directory language. E.g., if you find MessagesEs.php, you can use " " for Spanish. Do not use " " with a capital letter. Although it seems to work, not all texts are translated.

Note: After changing the language code, you will need to run a php script to make it work. With your command line tool, go to your wiki directory, open the "maintenance" folder, and type " ". Please note that on Windows, the PHP folder might not be included in the PATH environment variable.

Not all languages are supported. See here for a list of the localisation statistics of. See translatewiki.net for the statistics per released version.

Setting copyright for the site

 * $wgRightsPage is the page on the wiki that covers the copyrights that it falls under. Usually, this will be Project:Copyrights.
 * $wgRightsUrl is the page describing full details of your license. (For the GNU FDL, for example, this would be .)
 * $wgRightsText is the text in the footer that follows "Content is available under". It will be linked to the page specified in.
 * $wgRightsIcon is the URL of the image placed at the left of the footer.
 * Note: If  is non-empty, the link in the copyright/license notice will link to that page on your site. If   is empty then the copyright/license notice will link to   instead.
 * $wgEnableDublinCoreRdf and $wgEnableCreativeCommonsRdf to add RDF meta data to wiki pages. For more details about RDF metadata see RDF metadata.

To modify the copyright statements of the site, add something like this to LocalSettings.php: Afterwards, edit MediaWiki:Copyright to provide an appropriate message, using  to indicate the position where the link to your copyright page will be.

Example: setting a Creative Commons license

To set a Creative Commons license do the following:


 * Choose your license: http://creativecommons.org/text/publish-website
 * Examine the returned HTML code, e.g.:
 * For  enter the href info from the first anchor:
 * For  enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
 * For  enter the src info from the img link in the first anchor. You want to copy the badge to your own site instead of using the one from the Creative Commons site.


 * For using RDF metadata about copyright add one or both of the following lines to your LocalSettings.php

Custom namespaces
By declaring the $wgExtraNamespaces array, and modifying the $wgNamespacesWithSubpages, and $wgNamespacesToBeSearchedDefault arrays, extra namespaces can be added to a MediaWiki installation; and by declaring the $wgNamespaceAliases array namespace aliases can be added. Take heed not to have any pages already titled in that namespace, for instance in you had a page called "Technical:Support" and you created the Technical: namespace, then that page would not only be lost, but you cannot remove it from Special:Allpages. To fix this delete the namespace, move "Technical:Support" to "Support" in mainspace, delete the redirect, reinsert the namespace, and move it back to "Technical:Support". See Custom namespaces for more information as to how to do so.

Skins
The default skin of the site can be modified via the $wgDefaultSkin variable.