Kézikönyv:LocalSettings.php

From mediawiki.org
This page is a translated version of the page Manual:LocalSettings.php and the translation is 40% complete.
Outdated translations are marked like this.
Figyelem Figyelem: Ne szerkeszd a LocalSettings.php-t Jegyzettömbbel (csak a Windows 10 1809-es és korábbi verziói esetén), TextEdittel, vagy bármilyen szövegszerkesztővel, amely bájtsorrendjelet tesz a fájlokba. Ezek problémákat okozhatnak a PHP működésében. A fájl szerkesztéséhez inkább kódszerkesztőt (pl. Vim vagy Notepad++) használj. Ezek megfelelően kezelik a különféle kódolásokat. Ezen felül képesek helyrehozni a Jegyzettömb-típusú szerkesztők által tönkretett fájlokat.

The LocalSettings.php file provides basic configuration settings of a MediaWiki installation. You should take your time to review the settings in this file. The file is usually generated by the web-based MediaWiki installer but you can tweak the parameters, possibly in concert with Apache settings. For MediaWiki installations configured as a wiki farm, a file named CommonSettings.php may be used.

Helye a szerveren

A LocalSettings.php nem wikilap, és nem érhető el böngészőn keresztül. Instead, it is a file in the file system of the server. Its contents are generated during the initial setup of the wiki, and the resulting file must be copied to the server manually. A fájl a szerveren található, tartalmát pedig a telepítő hozza létre; az elkészült állományt manuálisan kell átmásolni. A fájlnak ugyanazon könyvtárban kell lenniük, mint például az includes/ és skins/ mappáknak és az api.php-nek. If this file is not there, the wiki will not work at all—if the wiki does work, the file is there. If you do not know where it is, you can enter a command such as find / -iname LocalSettings.php -print in a terminal window to locate it.

(Vagrant használata esetén olvasd el ezt).

Biztonság

A LocalSettings.php bizalmas adatokat (például az adatbázisok jelszavait) tartalmazza. Ezért soha nem szabad megosztani! Egyes szerverhibák esetén a fájl kívülről is olvasható. Ennek megakadályozására be állítani a fájlra vonatkozó UNIX-jogosultságokat. A webszerverhez rendelt felhasználónak hozzá kell férnie az állományhoz. Ha ez azonos a tulajdonossal, a jogokat 600-ra kell állítani. Néha a webszerverhez rendelt felhasználó nem a tulajdonos, de azonos UNIX-felhasználócsoportban van. Ez esetben a 640 az ideális választás. A biztonság további növelése érdekében érdemes csak a legszükségesebb jogokat biztosítani.

Additionally, you can create a MySQL user, who is restricted to only the database used by the wiki and provide this user's credentials in LocalSettings.php. Also you can configure your database server to only accept connections from localhost - this should prevent access from outside in case of leaked credentials.

See also Manual:Securing database passwords for a method to move the sensitive parts of LocalSettings.php to a different file in a different directory.

Tartalma

Amikor szerkeszted a fájlt, győződj meg róla, hogy helyes kódolást (ANSI UTF-8-ként vagy UTF-8 BOM nélkül) választasz.

A fájl PHP-kódot tartalmaz, elsősorban változókat és azok értékeit. A beállítások megváltoztatása a változók átírásával lehetséges. A változtatásaid a mentéskor azonnal életbe lépnek; így nem szükséges bármit is újraindítanod. Néha szükséges lehet a böngésző gyorsítótárának törlése.

Az alapértelmezett értékek a includes/DefaultSettings.php fájlban találhatók; ezt ne szerkeszd; ha módosítani szeretnél valamit, akkor másold át a LocalSettings.php-be, és ott írd át. Ez utóbbihoz új sorokat is hozzáadhatsz. Within LocalSettings.php you can add new lines at the end.

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

Like most PHP files in MediaWiki, LocalSettings.php 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 LocalSettings.php (see e.g. [1]). 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.

This file is not written to your webserver automatically for security reasons. Instead, it is offered as a download, which you must then upload to your server for your wiki to begin working. For a more complete explanation, see this explanation.

Az elérhető beállítások áttekintése

A változók funkcióját megtalálhatod a beállítások tárgymutatójában és a fájlokba írt megjegyzésekben. Alább a legfontosabb változók és legkeresettebb funkciók listáját olvashatod.

Alapbeállítások

Telepítési út

The $IP (install path) variable holds the local file path to the base installation of your wiki. Since MediaWiki 1.18, the system sets $IP automatically. Setting $IP manually in LocalSettings.php is no longer needed. $IP will default to the current working directory and can be used without the need to manually define it. Attempting to set $IP (or MW_INSTALL_PATH) in LocalSettings.php may produce unexpected results.

A DefaultSettings.php fájl a változóban megadott könyvtárból töltődik be.

Oldalnév

$wgSitename 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 $wgGrammarForms (for example please refer to the $wgSitename documentation page).

Oldal nyelve

$wgLanguageCode 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.

Szkriptút

$wgScriptPath 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.

Szervernév

$wgServer 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, email notifications and a few other computed messages would be usually delivered with the different URLs.

A MediaWiki 1.34-től a $wgServer-nek a LocalSettings.php-ben kell lennie. Prior to that, MediaWiki tried to autodetect the name of the server and $wgServer 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

$wgServer = 'http://www.example.com';

The magic word variable {{SERVER}} can be used on wiki pages; it equals the value of $wgServer; 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 //www.mediawiki.org, which can neither be clicked nor copy-pasted into the address bar as it is.

You can also use a protocol relative URL as shown below. When using a protocol relative URL, be sure to set $wgCanonicalServer. $wgCanonicalServer is needed for some places in the code where an origin with a protocol and hostname is needed.

$wgServer = '//www.example.com';
$wgCanonicalServer = 'https://www.example.com';

Szkriptnév

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

Cikkút

$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 $wgScript) and use the $1 placeholder for the article name.

If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust $wgArticlePath 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:

"$wgScript/$1" pass the article name with separator "/"
"$wgScript?title=$1" pass the article name as a parameter (old style)
"/mypath/$1" custom path. Use Apache rewrite rules to convert "mypath" to the proper path accessing the main script

Stylesheet location

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

Feltöltési könyvtár

A feltöltött fájlok URL-címét az $wgUploadPath , a fájlszerveren elfoglalt helyüket pedig az $wgUploadDirectory változókban lehet beállítani.

Logó

A bal felső sarokban elhelyezett kép megváltoztatása a $wgLogo változó módosításával lehetséges; a lépés felülírja a /wiki/skins/common/images/ mappában lévő alapértelmezett grafikát (a /wiki a saját telepítésed helye).

Első lépésként töltsd fel a kívánt képet a /wiki/skins/common/images/ (a /wiki a saját telepítésed helye).

Keresd meg a következő sort a LocalSettings.php-ban:

$wgLogo = "$wgStylePath/common/images/wiki.png";

Ha nincs ilyen, másold be a fenti sort az állomány végére.

Ezután írd át az útvonalat; a képnek az internet felől elérhetőnek kell lenni, mivel a böngészők a változó értékét használják. Ha nem tudod, hogy töltsd ki, navigálj el böngésződben a kívánt grafikához (például a MediaWiki.org logója a http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png címen található), majd a címsorban látható URL-t másold át a változóhoz.

Egyesek a skins/common/images/wiki.png útvonalon található alapértelmezett képfájlt cserélik le; ez nem javasolt, mert egy frissítés felülírhatja.

MediaWiki 1.35 introduced $wgLogos , which allows multiple versions of the same logo. An example of using multiple logos is shown below.

$wgLogos = [
	'1x' => "$wgStylePath/common/images/1x_version.png",
	'1.5x' => "$wgStylePath/common/1.5x_version.png",
	...
	'tagline' => [
		'src' => "$wgStylePath/common/tagline_version.png",
		'width' => 135,
		'height' => 15,
	],
];

Kapcsolatfelvételi adatok

Az $wgEmergencyContact a probléma esetén elérhető és a hibabejelentéseket is fogadó személy e-mail-címe. Adminisztrátorként is ide írd címed

A $wgPasswordSender -ben megadott címről küldi a szerver a jelszó-emlékeztetőket. Olyan címet válassz, amelyik bejövő leveleket is fogad, hogy probléma esetén a felhasználók ide fordulhassanak.

Adatbázis-beállítások

A lapok, módosítások, felhasználói adatok és sok más tárolásához a MediaWikinek hozzá kell férnie az adatbázishoz (amely lehet MySQL vagy PostgreSQL is).

Az adatbázis helyét a $wgDBserver tárolja; ez általában (ha az adatbázis azonos rendszeren van) localhost, de megosztott telepítéseknél meg kell adni a pontos domain-nevet.

Az adatbázis nevét a $wgDBname -ben lehet megadni. Egy MySQL- vagy PostgreSQL-telepítés több adatbázist is tárolhat, így egy szerverre több wikit is telepíthetsz. Győződj meg róla, hogy különböző neveket választottál, és ezeket mindig pontosan add meg.

Az adatbázis nevét a $wgDBuser , a jelszavát pedig a $wgDBpassword tárolja. Ahhoz, hogy a MediaWiki hozzáférhessen az állományokhoz, a felhasználónak elegendő jogosultsággal kell rendelkeznie.

Also see Manual:Securing database passwords for a method to move the sensitive parts of LocalSettings.php to a different file in a different directory.

Felhasználói jogosultságok

$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 $wgCapitalLinks . Setting it to false allows lowercase characters, true chooses the default behavior.

Allapok engedélyezése

In LocalSettings.php, subpages are enabled on a per-namespace basis using $wgNamespacesWithSubpages . For example, to enable subpages in the main namespace:

$wgNamespacesWithSubpages[NS_MAIN] = 1;

Képek feltöltése

Mielőtt a felhasználók képeket tölthetnének fel, engedélyezned kell azt. Győződj meg róla, hogy beállítottad a feltöltési könyvtár útvonalát, és a webszerver írási jogokkal rendelkezik hozzá. Majd módosítsd a $wgEnableUploads változót true értékre.

például: Beillesztendő kódrészlet az includes/DefaultSettings.php fájlból:

$wgUploadPath       = "$wgScriptPath/uploads";      ## Wiki 1.5 defaults to /images, but allows more than just images
$wgUploadDirectory  = "$IP/uploads";                ## Wiki 1.5 defaults to /images, but allows more than just images

## To enable image uploads, make sure the above '$wgUploadPath' directory is writable by Apache User or group.
## ''(i.e.  chmod og+w uploads images)''  then the following should be true:
$wgEnableUploads       = true;

$wgUseImageMagick      = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

## If you want to use image uploads under safe mode, create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment this, if it's not already uncommented:
$wgHashedUploadDirectory = false;

A képek időközi átméretezéséhez (bélyegképek használatához) szükség van az ImageMagick telepítésére. A telepítés és tesztelés után után a $wgUseImageMagick változót true értékre kell állítani. Make sure $wgImageMagickConvertCommand points to the proper location of the convert command of your installation, that the command is executable by the web server process, and $wgMaxShellMemory is large enough. További információkért és hibaelhárításért olvasd el ezt .

Az elfogadott kiterjesztések listáját a $wgFileExtensions változó tárolja.

$wgFileExtensions = [ 'png', 'jpg', 'jpeg', 'ogg', 'doc', 'xls', 'ppt', 'mp3', 'sxc', 'pdf' ];

Ha az ImageMagick a következő hibaüzenettel tér vissza:

Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506

add hozzá a következő sort a LocalSettings.php-hez:

$wgMimeDetectorCommand = "file -bi";

Interwikik támogatása

A MediaWiki alapértelmezésben támogatja az interwikik használatát, de a használandó előtagot neked kell beállítani. This prefix is usually the same as $wgSitename , but in case you need to change that, you set the $wgLocalInterwikis variable to the preferred name.


Felhasználói felület nyelve

A MediaWiki az alapértelmezett angolon kívül számos más nyelvet is támogat; a módosítás a $wgLanguageCode átírásával lehetséges (például hu a magyarhoz; a további lehetőségeket lásd itt).

Bármely, a languages/i18n könyvtárban látható nyelvkódot használhatod; például a hu.json meglétekor a hu változó magyarra módosítja a felületet (ne használd a nagybetűs (Hu) formát, mert így nem minden lesz lefordítva).

A nyelvi kód megváltoztatása után futtatnia kell egy PHP parancsfájlt annak működéséhez. A terminálablakban váltson a wiki könyvtárára, váltson a maintenance mappára, és írja be a php rebuildMessages.php --rebuild parancsot. On Windows, the PHP folder might not be in your PATH environment variable and you'll have to prefix php with the path to the program.

Nem minden nyelv támogatott; a 1.43.0-wmf.1 (8e1947e) verzió fordítási statisztikáit itt találod, a verziónkénti bontás pedig a translatewiki.neten tekinthető meg. See the translation statistics on TranslateWiki for an up-to-date list of which languages are supported and to what extent. That list reflects the current state of MediaWiki core, so depending on what version you are using there may be a discrepancy.

Szerzői jogi beállítások

  • $wgRightsText is the text in the footer that follows "Content is available under". It will be linked to the page specified in $wgRightsPage.
  • $wgRightsIcon is the URL of the image placed at the left of the footer.
If $wgRightsPage is non-empty, the link in the copyright/license notice will link to that page on your site. If $wgRightsPage is empty then the copyright/license notice will link to $wgRightsUrl instead.

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

$wgRightsPage = "YourWiki:Copyright";
$wgRightsText = "copyright YourWiki";

Afterwards, edit MediaWiki:Copyright to provide an appropriate message, using "$1" to indicate the position where the link to your copyright page will be.

Példa: Creative Commons-licensz beállítása

Végezd el az alábbiakat:

  • Examine the returned HTML code, e.g.:
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
<img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights30.png" />
</a>
This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License</a>.
  • For $wgRightsURL enter the href info from the first anchor:
$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
  • For $wgRightsText enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";
  • For $wgRightsIcon 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.
$wgRightsIcon = "http://creativecommons.org/images/public/somerights30.png";
  • For using RDF metadata about copyright add one or both of the following lines to your LocalSettings.php:
$wgEnableCreativeCommonsRdf = true;
$wgEnableDublinCoreRdf = true;


Egyedi névterek

By declaring $wgExtraNamespaces , and modifying $wgNamespacesWithSubpages , and $wgNamespacesToBeSearchedDefault , 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 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 Custom namespaces for more information as to how to do so.

Felületek

Az alapértelmezett felület a $wgDefaultSkin változóval módosítható.

Lásd még