Manual:LocalSettings.php/cs

Soubor   poskytuje základní konfigurační nastavení (na základě souboru ) instalace MediaWiki. Určitě si udělejte čas na kontrolu nastavení v tomto souboru. Soubor je obvykle generován webovým instalátorem MediaWiki, ale můžete si vyladit parametry, případně ve shodě s nastavením Apache. U instalací MediaWiki nakonfigurovaných jako wiki farma lze použít soubor s názvem.

Umístění na serveru
Soubor  není wiki stránka a nemůžete k němu přistupovat pomocí webového prohlížeče. Místo toho je to soubor umístěný v systému souborů na serveru. Jeho obsah je generován během počátečního nastavení wiki a výsledný soubor musí být zkopírován na server ručně. Soubor musí být umístěn ve složce, do které jste nainstalovali MediaWiki, na stejné úrovni se složkami jako  a   a soubory jako. Pokud tam tento soubor není, wiki nebude fungovat vůbec - pokud wiki funguje, pak tam soubor je. Pokud nevíte, kde se nachází, můžete do terminálového okna zadat příkaz, například find / -iname LocalSettings.php -print.

(Pokud používáte Vagrant, podívejte se také na MediaWiki-Vagrant#MediaWiki_settings.)

Zabezpečení
obvykle obsahuje citlivá data, například přihlašování do databáze. Tyto údaje by „nikdy“ neměly být veřejně přístupné! Kvůli narušení zabezpečení někde na serveru se může stát, že ostatní uživatelé budou moci prohlížet obsah souborů. Chcete-li zvýšit zabezpečení svých dat, měli byste pro tento soubor odpovídajícím způsobem nastavit oprávnění UNIX: Uživatel webového serveru musí mít přístup k tomuto souboru. Pokud se jedná o stejný účet, který je vlastníkem souboru, můžete nastavit oprávnění na 600. Uživatel webového serveru někdy není vlastníkem souboru, ale je ve skupině uživatelů systému UNIX vlastníka. V tomto případě by měla být povolení 640 v pořádku. Pro lepší zabezpečení byste měli omezit oprávnění dolů, jak je to možné.

Kromě toho můžete vytvořit uživatele MySQL, který je omezen pouze na databázi používanou wiki, a zadat pověření tohoto uživatele v. Databázový server můžete také nakonfigurovat tak, aby akceptoval pouze připojení z localhost - v případě úniku pověření by to mělo zabránit přístupu zvenčí.

Obsah souboru
Když upravujete, nezapomeňte jej znovu uložit do správného kódování. Měli byste použít kódování "ANSI jako UTF-8" - to je kódování UTF-8 bez značky pořadí bajtů (BOM).

obsahuje PHP kód. Hlavně definice proměnných a jejich hodnot. Změna nastavení obvykle znamená změnu hodnoty proměnné PHP. Změny se projeví okamžitě po opětovném uložení souboru na server. Není třeba nic ručně restartovat. V některých případech však možná budete muset vymazat mezipaměť prohlížeče, abyste viděli skutečně provedené změny.

Výchozí hodnoty mnoha dalších nastavení jsou nastaveny v, které by nemělo být upravováno, pokud proměnná, kterou chcete změnit, již není ve vašem  , zkopírujte příslušný řádek z   a odpovídajícím způsobem jej upravte v. V rámci  můžete na konec přidat nové řádky.

Within the file, there can also be several lines such as ' ', which point to extensions. These lines enable the according extension in the wiki. Those extensions may require setting the values of more variables in ; check the documentation of the according extension for further instructions.

Like most PHP files in MediaWiki,  does not end with the closing PHP tag. This prevents admins from accidentally adding new information after this tag. PHP works fine without a closing tag.

If you have a wiki on a MediaWiki wiki farm you may not have write-access (perhaps not even read-access) to the file  (see e.g.). The wiki farm company may or may not be willing to make changes you desire. Perhaps it wants to keep most settings the same on all wikis of the wiki farm.

Přehled nastavitelných parametrů
See the configuration settings index and the comments included in the settings files for help on what all the variables do. A short listing of the most important variables, as well as the most requested features, is listed below.

Include path
The $IP (include path) variable holds the local file path to the base installation of your wiki. Since MediaWiki 1.17, MediaWiki is setting $IP automatically - setting it manually in  is no longer needed. It will default to the current working directory automatically and can be used without the need to manually define it.

The DefaultSettings.php file gets loaded from the directory designated by the IP variable.

Site name
 holds the name of your wiki setup. This name gets included many times throughout the system, such as via MediaWiki:Pagetitle. For instance, the Wikipedia tagline "From Wikipedia, the free encyclopedia" makes use of this setting.

Declensions of site name
Some translations of interface are ready for inflection of site name. You can set proper forms of word in variables ' (for example please refer to the ' documentation page).

Výchozí jazyk
 controls the language of your wiki's interface. While users can switch the language they see in their preferences, this variable sets the default language that all anonymous users and most registered users see.

Cesta ke skriptům
 is the URL path prefix to access the main MediaWiki script that is the central acting piece of code of MediaWiki. This setting should correspond to the Apache settings, especially if you are using Apache's rewrite rules.

Jméno serveru
 contains the base URL of the server, including protocol but without the trailing slash and without the subdirectory if any. When the wiki is accessed from either the localhost where it runs, from an intranet or from the internet, e-mail notifications and a few other computed messages would be usually delivered with the different URLs.

From MediaWiki 1.34  must be set in LocalSettings.php. Prior to that, MediaWiki tried to autodetect the name of the server and  was optional, to override the autodetection.

If www.example.com is the server address of your wiki as seen from the internet, add a line such as

The magic word variable  can be used on wiki pages; it equals the value of  ; however, on a wiki, such as those in the WikiMedia family, where relative urls are used, it will not fully expand, for example here it displays, which can neither be clicked nor copy-pasted into the address bar as it is.

Script name
 is the name of the main (index) MediaWiki PHP script, named  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
 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.

Cesta ke článkům
 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   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:

Umístění souboru s nastavením stylu
Use  to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located.  should point the same place, but note that this is a local file system path for use in internal scripts accessing the file system.

Adresář pro uploadované soubory
The upload directory is the place where files uploaded by the users are stored. ' specifies the URL path, ' points to the local file system path.

Logo
 specifies which graphical logo is displayed in the top left corner of all mediawiki pages. These steps replace the default logo in the /wiki/skins/common/images/ directory, replacing /wiki with the path to the directory where you installed the MediaWiki software.

First, copy whatever logo you want into the /wiki/skins/common/images/ directory (replacing /wiki with the path to the directory where you installed the MediaWiki software).

Next, try to find the line that looks like this in :

If there's no such line, you can copy and paste the line above at the end of the file.

Then, modify that line to point to your logo. The logo must be web accessible. The value of this variable is passed to the web browser, which uses it to fetch the logo. If in doubt, a good way to pick what to put here is navigate to the logo in your web browser (for example, this wiki the url of the logo is http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png ), and put the full url as the value of this variable.

Some people just replace the skins/common/images/wiki.png file with their logo. This is not recommended, as the customized logo would be overwritten on upgrade.

Kontaktní informace
 is the e-mail address of the user to contact if something goes wrong. This e-mail address is used to send internal bug reports to. As an administrator, you want to include your e-mail address here.

 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.

Nastavení databáze
MediaWiki needs access to the database (currently either MySQL or PostgreSQL) to store pages, modifications, user information, and a lot more things.

 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.

 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.

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

Uživatelská práva
 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 for more information about the different permissions and user groups available.

Vynucení kapitálek v odkazech
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 . Setting it to false allows lowercase characters, true chooses the default behavior.

Zapnutí podstránek
In, subpages are enabled on a per-namespace basis using . For example, to enable subpages in the main namespace:

Nahrávání obrázků
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  to true to allow uploading in the web user interface.

i.e. Here's some example code from includes/DefaultSettings.php to put in :

If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working ImageMagick installation. Set  to true once you have installed and tested ImageMagick on your system. Make sure ' points to the proper location of the  command of your installation, that the command is executable by the web server process, and ' is large enough. See for detailed information and trouble-shooting.

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

In case ImageMagick outputs an error message similar to the following:
 * Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506

then try adding the following line to :

= "file -bi";

Podpora interwiki
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, but in case you need to change that, you set the variable to the preferred name.

Jazyk uživatelského rozhraní
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 variable to the proper language code (e.g. "de" for German, "es" for Spanish, etc.)

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

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

Nastavení copyrightu

 *  is the page on the wiki that covers the copyrights that it falls under. Usually, this will be Project:Copyrights.
 *  is the page describing full details of your license. (For the GNU FDL, for example, this would be .)
 *  is the text in the footer that follows "Content is available under". It will be linked to the page specified in.
 *  is the URL of the image placed at the left of the footer.

To modify the copyright statements of the site, add something like this to :

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/choose/
 * 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 :

Uživatelské jmenné prostory
By declaring ', and modifying ', and ', extra namespaces can be added to a MediaWiki installation; and by declaring the ' array namespace aliases can be added. Take heed not to have any pages already titled in that namespace, for instance if 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 for more information as to how to do so.

Témata (skiny)
The default skin of the site can be modified via .

Viz též

 * source code, which generates the inital contents of  during installation.
 * Wiki families can share the same.
 * Manual:Securing database passwords - a guide to securing your database passwords and  file.