User:Tpu4e/ru: Difference between revisions

From Yerbas Wiki
Jump to navigation Jump to search
(Created page with "созданный во время установки")
 
(Created page with "Файл $1 содержит базовые параметры конфигурации (на основе файла $3) установки MediaWiki.")
Tag: Replaced
Line 1: Line 1:
<languages/>
Файл '''<code>LocalSettings.php</code>''' содержит базовые [[Special:MyLanguage/Manual:Configuration settings|параметры конфигурации]] (на основе файла <code>'''{{ll|Manual:DefaultSettings.php|DefaultSettings.php}}'''</code>) установки [[Special:MyLanguage/MediaWiki|MediaWiki]].
{{BOMWarning}}
{{MW file|LocalSettings.php|NotInGit=созданный во время установки}}
 
<span lang="en" dir="ltr" class="mw-content-ltr">The '''<code>LocalSettings.php</code>''' file provides basic [[Special:MyLanguage/Manual:Configuration settings|configuration settings]] (based on the <code>'''{{ll|Manual:DefaultSettings.php|DefaultSettings.php}}'''</code> file) of a [[Special:MyLanguage/MediaWiki|MediaWiki]] installation.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">You should take your time to review the settings in this file.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">You should take your time to review the settings in this file.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The file is usually generated by the web-based MediaWiki installer but you can tweak the parameters, possibly in concert with Apache settings.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The file is usually generated by the web-based MediaWiki installer but you can tweak the parameters, possibly in concert with Apache settings.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">For MediaWiki installations configured as a [[Special:MyLanguage/Manual:Wiki family|wiki farm]], a file named <code>{{ll|Manual:CommonSettings.php|CommonSettings.php}}</code> may be used.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">For MediaWiki installations configured as a [[Special:MyLanguage/Manual:Wiki family|wiki farm]], a file named <code>{{ll|Manual:CommonSettings.php|CommonSettings.php}}</code> may be used.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
== Location on the server ==
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">The <code>LocalSettings.php</code> file is not a wiki page, and you cannot access it with your web browser.</span>
<!-- there were multiple(!) people assuming on the talk page that it _was_ a wiki page or at least web accessible -->
<span lang="en" dir="ltr" class="mw-content-ltr">Instead, it is a file in the file system of the server.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Its contents are generated during the initial setup of the wiki, and the resulting file must be copied to the server manually.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The file must be located in the folder you installed MediaWiki into, on the same level with folders like <code>includes/</code>and <code>skins/</code> and files like <code>api.php</code>.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">If this file is ''not'' there, the wiki will not work at all—if the wiki ''does'' work, the file ''is there''.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">If you do not know where it is, you can enter a command such as <kbd>find / -iname LocalSettings.php -print</kbd> in a terminal window to locate it.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
(If you are using Vagrant, see also [[Special:MyLanguage/MediaWiki-Vagrant#mw-settings|MediaWiki-Vagrant#MediaWiki_settings]].)
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
== Security ==
</div>
<span lang="en" dir="ltr" class="mw-content-ltr"><code>LocalSettings.php</code> usually contains sensitive data such as database logins.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">This data should ''never'' be revealed to the public!</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Due to a security breach somewhere on the server, it might happen that other users are able to view the contents of files.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">In order to improve security of your data, you should set UNIX permissions for this file accordingly: The webserver user must have access to this file.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">If this is the same account, who is the owner of the file, then you can set permissions to ''600''.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Sometimes, the webserver user is ''not'' the file owner, but they are in the owner's UNIX user group.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">In this case, permissions of ''640'' should be fine. For improved security you should narrow permissions down as far as possible.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
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 <code>LocalSettings.php</code>. Also you can configure your database server to only accept connections from localhost - this should prevent access from outside in case of leaked credentials.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
See also {{ll|Manual:Securing database passwords}} for a method to move the sensitive parts of <code>LocalSettings.php</code> to a different file in a different directory.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
== File contents ==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
When you edit <code>LocalSettings.php</code>, make sure to save it in the right encoding again. You should use "ANSI as UTF-8" encoding - that is UTF-8 encoding without byte order mark (BOM).
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<code>LocalSettings.php</code> contains [[w:PHP|PHP code]]; mainly the definition of variables and their values. Changing a setting usually means changing the value of a PHP variable. Your changes will take effect immediately after saving the file again on the server: There is no need to manually "restart" anything. Anyway, in some cases you may need to clear your browser's cache to actually see the changes you made.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
The ''default'' values of many more settings are set in <code>includes/DefaultSettings.php</code>, ''which should not be edited;'' if the variable you want to change is not already mentioned in your <code>LocalSettings.php</code>, copy the appropriate line from <code>DefaultSettings.php</code> and modify it appropriately in <code>LocalSettings.php</code>. '''Within <code>LocalSettings.php</code> you can add new lines at the end.'''
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
Within the file, there can also be several lines such as '<code>require_once "$IP/extensions/''extension''.php";</code>', which point to [[Special:MyLanguage/Extension:Contents|extensions]]. These lines enable the according extension in the wiki. Those extensions may require setting the values of more variables in <code>LocalSettings.php</code>; check the documentation of the according extension for further instructions.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
Like most PHP files in MediaWiki, <code>LocalSettings.php</code> does not end with the closing PHP tag {{phpi|?>}}. This prevents admins from accidentally adding new information ''after'' this tag. PHP works fine without a closing tag.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
If you have a wiki on a MediaWiki [[w:wiki farm|wiki farm]] you may not have write-access (perhaps not even read-access) to the file <code>LocalSettings.php</code> (see e.g. [http://community.wikia.com/wiki/Forum%3ALocalSettings.php%3F]). 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.
</div>
{{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">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 [//www.mediawiki.org/w/index.php?title=New-installer_issues&diff=334526&oldid=333913 this explanation].</span>}}
<div lang="en" dir="ltr" class="mw-content-ltr">
== Overview of available settings ==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
See the [[Special:MyLanguage/Manual:Configuration settings|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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
==Standard settings==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Install path===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">The '''{{ll|Manual:$IP|$IP}}''' (install path) variable holds the local file path to the base installation of your wiki.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Since MediaWiki 1.18, the system sets $IP automatically.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Setting {{phpi|$IP}} manually in <code>LocalSettings.php</code> is no longer needed.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">{{phpi|$IP}} will default to the current working directory and can be used without the need to manually define it.</span>
Attempting to set {{phpi|$IP}} (or <code>MW_INSTALL_PATH</code>) in <code>LocalSettings.php</code> may produce unexpected results.
<div lang="en" dir="ltr" class="mw-content-ltr">
The {{ll|Manual:DefaultSettings.php|DefaultSettings.php}} file gets loaded from the directory designated by the IP variable.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Site name===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgSitename|$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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
=== Declensions of site name ===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">Some translations of interface are ready for inflection of site name.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">You can set proper forms of word in variables '''{{ll|Manual:$wgGrammarForms|$wgGrammarForms}}''' (for example please refer to the '''{{ll|Manual:$wgSitename|$wgSitename}}''' documentation page).</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Site language===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">'''{{ll|Manual:$wgLanguageCode|$wgLanguageCode}}''' controls the language of your wiki's interface.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">While users can switch the language they see in their [[Special:Preferences|preferences]], this variable sets the default language that all anonymous users and most registered users see.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Script path===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">'''{{ll|Manual:$wgScriptPath|$wgScriptPath}}''' is the URL path prefix to access the main MediaWiki script that is the central acting piece of code of MediaWiki.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">This setting should correspond to the [[Special:MyLanguage/Apache configuration|Apache settings]], especially if you are using Apache's [[w:Rewrite_engine|rewrite]] rules.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Server name===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgServer|$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.
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">From MediaWiki 1.34 {{phpi|$wgServer}} must be set in LocalSettings.php.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Prior to that, MediaWiki tried to autodetect the name of the server and {{phpi|$wgServer}} was optional, to override the autodetection.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
If www.example.com is the server address of your wiki as seen from the internet, add a line such as
</div>
<syntaxhighlight lang="php">
$wgServer = 'http://www.example.com';
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
The [[m:Special:MyLanguage/Help:Magic words#Page names and related info|magic word]] variable <code><nowiki>{{SERVER}}</nowiki></code> can be used on wiki pages; it equals the value of {{phpi|$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 {{SERVER}}, which can neither be clicked nor copy-pasted into the address bar as it is.
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">You can also use a protocol relative URL as shown below.</span>
When using a protocol relative URL, be sure to set {{phpi|$wgCanonicalServer}}.
{{phpi|$wgCanonicalServer}} is needed for some places in the code where an origin with a protocol and hostname is needed.
<syntaxhighlight lang="php">
$wgServer = '//www.example.com';
$wgCanonicalServer = 'https://www.example.com';
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Script name===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgScript|$wgScript}}''' is the name of the main (index) MediaWiki PHP script, named <code>index.php</code> 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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Article path===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">'''{{ll|Manual:$wgArticlePath|$wgArticlePath}}''' is the path to use when accessing a page in MediaWiki.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">The path should contain the path to the main script (usually making use of {{phpi|$wgScript}}) and use the <code>$1</code> placeholder for the article name.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust {{phpi|$wgArticlePath}} to address the right path.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Note that wgArticlePath is used to construct URLs from within MediaWiki.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">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.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">See {{ll|Manual:Short URL}} for more information on URL configuration.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
Typical values are:
</div>
{| class="wikitable"
| <code>"$wgScript/$1"</code>
| <span lang="en" dir="ltr" class="mw-content-ltr">pass the article name with separator "/"</span>
|-
| <code>"$wgScript?title=$1"</code>
| <span lang="en" dir="ltr" class="mw-content-ltr">pass the article name as a parameter (old style)</span>
|-
| <code>"/mypath/$1"</code>
| <span lang="en" dir="ltr" class="mw-content-ltr">custom path. Use Apache rewrite rules to convert "mypath" to the proper path accessing the main script</span>
|}
<div lang="en" dir="ltr" class="mw-content-ltr">
===Stylesheet location===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">Use '''{{ll|Manual:$wgStylePath|$wgStylePath}}''' to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">'''{{ll|Manual:$wgStyleDirectory|$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.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Upload location===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
The upload directory is the place where files uploaded by the users are stored. '''{{ll|Manual:$wgUploadPath|$wgUploadPath}}''' specifies the URL path, '''{{ll|Manual:$wgUploadDirectory|$wgUploadDirectory}}''' points to the local file system path.
</div>
{{anchor|Logo}}
<div lang="en" dir="ltr" class="mw-content-ltr">
===Logo===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgLogo|$wgLogo}}''' 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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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).
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
Next, try to find the line that looks like this in <code>LocalSettings.php</code>:
</div>
<syntaxhighlight lang="php" style="overflow:auto;">
$wgLogo = "$wgStylePath/common/images/wiki.png";
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
If there's no such line, you can copy and paste the line above at the end of the file.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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.
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">MediaWiki 1.35 introduced {{ll|Manual:$wgLogos|$wgLogos}}, which allows multiple versions of the same logo.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">An example of using multiple logos is shown below.</span>
<syntaxhighlight lang="php" style="overflow:auto;">
$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,
],
];
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Contact info===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgEmergencyContact|$wgEmergencyContact}}''' is the email address of the user to contact if something goes wrong. This email address is used to send internal bug reports to. As an administrator, you want to include your email address here.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgPasswordSender|$wgPasswordSender}}''' is the email address where email 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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Database settings===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
MediaWiki needs access to the database (currently either [[w:MySQL|MySQL]] or [[w:PostgreSQL|PostgreSQL]]) to store pages, modifications, user information, and a lot more things.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgDBserver|$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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgDBname|$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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgDBuser|$wgDBuser}}''' and '''{{ll|Manual:$wgDBpassword|$wgDBpassword}}''' 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.
</div>
Also see {{ll|Manual:Securing database passwords}} for a method to move the sensitive parts of <code>LocalSettings.php</code> to a different file in a different directory.
<div lang="en" dir="ltr" class="mw-content-ltr">
===User rights===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''{{ll|Manual:$wgGroupPermissions|$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 {{ll|Help:User rights}} for more information about the different permissions and user groups available.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Force capital links===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
By default, no page name can start with a lowercase [[w:Latin alphabet|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.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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 '''{{ll|Manual:$wgCapitalLinks|$wgCapitalLinks}}'''. Setting it to '''false''' allows lowercase characters, '''true''' chooses the default behavior.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Enabling subpages===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
In <code>LocalSettings.php</code>, [[Special:MyLanguage/Help:Subpages|subpages]] are enabled on a per-namespace basis using '''{{ll|Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages}}'''. For example, to enable subpages in the main namespace:
</div>
<syntaxhighlight lang="php">
$wgNamespacesWithSubpages[NS_MAIN] = 1;
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Image uploads===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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 '''{{ll|Manual:$wgEnableUploads|$wgEnableUploads}}''' to '''true''' to allow uploading in the web user interface.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
i.e. Here's some example code from ''includes/DefaultSettings.php'' to put in <code>LocalSettings.php</code>:
</div>
<syntaxhighlight lang="php" style="overflow:auto;">
$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;
</syntaxhighlight>
<span lang="en" dir="ltr" class="mw-content-ltr">If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working [[w:ImageMagick|ImageMagick]] installation.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Set '''{{ll|Manual:$wgUseImageMagick|$wgUseImageMagick}}''' to '''true''' once you have installed and tested ImageMagick on your system.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">Make sure '''{{ll|Manual:$wgImageMagickConvertCommand|$wgImageMagickConvertCommand}}''' points to the proper location of the <code>convert</code> command of your installation, that the command is executable by the web server process, and '''{{ll|Manual:$wgMaxShellMemory|$wgMaxShellMemory}}''' is large enough.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">See {{ll|Manual:Image administration#Image thumbnailing|Manual:Image administration#Image thumbnailing}} for detailed information and troubleshooting.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
Also, you may want to modify the list of accepted extensions, which is stored within '''{{ll|Manual:$wgFileExtensions|$wgFileExtensions}}''':
</div>
<syntaxhighlight lang="php">
$wgFileExtensions = [ 'png', 'jpg', 'jpeg', 'ogg', 'doc', 'xls', 'ppt', 'mp3', 'sxc', 'pdf' ];
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
In case ImageMagick outputs an error message similar to the following:
</div>
:  Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506
<div lang="en" dir="ltr" class="mw-content-ltr">
then try adding the following line to <code>LocalSettings.php</code>:
</div>
<code class="mw-code mw-highlight" style="display:block"><!--
-->{{ll|Manual:$wgMimeDetectorCommand|$wgMimeDetectorCommand}} = {{#tag:span|"file -bi"|class=s2}};
</code>
{{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">Read the [[Special:MyLanguage/Manual:Security#Upload security|upload security]] section in the [[Special:MyLanguage/Manual:Security#Upload security|Manual:Security]].</span><br />
<div lang="en" dir="ltr" class="mw-content-ltr">
Further information is available in:
</div>
* {{ll|Manual:Configuring file uploads}}
* {{ll|Manual:MIME type detection}}
* {{ll|Manual:Image administration#Image thumbnailing|2=<span lang="en" dir="ltr" class="mw-content-ltr">Manual:Image administration#Image thumbnailing</span>}}
<!-- should be synced or merged! -->
}}
<div lang="en" dir="ltr" class="mw-content-ltr">
===Interwiki support===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">[[w:InterWiki|InterWiki]] support is built into MediaWiki but you need to configure the prefix to be used for your internal links.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">This prefix is usually the same as {{wg|Sitename}}, but in case you need to change that, you set the {{wg|LocalInterwiki}} variable to the preferred name.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Language of user interface===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
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 {{wg|LanguageCode}} variable to the proper [[Special:SiteMatrix|language code]] (e.g. "de" for German, "es" for Spanish, etc.)
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
You may use any of the languages with a file in the directory {{git file |file=languages/i18n}}. E.g. if you find <code>es.json</code>, then you can use <code>"es"</code> for Spanish. Do not use <code>"Es"</code> with a capital letter. Although it seems to work, not all texts are translated.
</div>
{{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">After changing the language code, you will need to run a PHP script to make it work.</span> <span lang="en" dir="ltr" class="mw-content-ltr">In a terminal window, change to your wiki directory, change to the <code>maintenance</code> folder, and enter <syntaxhighlight lang=bash inline>php rebuildMessages.php --rebuild</syntaxhighlight>.</span> <span lang="en" dir="ltr" class="mw-content-ltr">On Windows, the PHP folder might not be in your <code>PATH</code> environment variable and you'll have to prefix <kbd>php</kbd> with the path to the program.</span>}}
<div lang="en" dir="ltr" class="mw-content-ltr">
Not all languages are supported. See [[localisation statistics|here]] for a list of the localisation statistics of {{CURRENTVERSION}}. See [[betawiki:Translating:Statistics|translatewiki.net]] for the statistics per released version.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Setting copyright for the site===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''{{ll|Manual:$wgRightsPage|$wgRightsPage}}''' is the page on the wiki that covers the copyrights that it falls under. Usually, this will be [[Project:Copyrights]].
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''{{ll|Manual:$wgRightsUrl|$wgRightsUrl}}''' is the page describing full details of your license. (For the GNU FDL, for example, this would be <code>http://www.gnu.org/licenses/fdl.html</code>.)
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''{{ll|Manual:$wgRightsText|$wgRightsText}}''' is the text in the footer that follows "Content is available under". It will be linked to the page specified in <code>$wgRightsPage</code>.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* '''{{ll|Manual:$wgRightsIcon|$wgRightsIcon}}''' is the URL of the image placed at the left of the footer.
</div>
{{note|1=<span lang="en" dir="ltr" class="mw-content-ltr">If <code>$wgRightsPage</code> is non-empty, the link in the copyright/license notice will link to that page on your site. If <code>$wgRightsPage</code> is empty then the copyright/license notice will link to <code>$wgRightsUrl</code> instead.</span>}}
<div lang="en" dir="ltr" class="mw-content-ltr">
To modify the copyright statements of the site, add something like this to <code>LocalSettings.php</code>:
</div>
<syntaxhighlight lang="php" style="overflow:auto;">
$wgRightsPage = "YourWiki:Copyright";
$wgRightsText = "copyright YourWiki";
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
Afterwards, edit [[MediaWiki:Copyright]] to provide an appropriate message, using <code>"$1"</code> to indicate the position where the link to your copyright page will be.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
'''Example: setting a [[w:Creative Commons|Creative Commons]] license'''
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
To set a Creative Commons license do the following:
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
* Choose your license: http://creativecommons.org/choose/
* Examine the returned HTML code, e.g.:
</div>
<syntaxhighlight lang="html4strict" style="overflow:auto;">
<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>.
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
* For <code>$wgRightsURL</code> enter the href info from the first anchor:
</div>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
* For <code>$wgRightsText</code> enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
</div>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
* For <code>$wgRightsIcon</code> 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.
</div>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsIcon = "http://creativecommons.org/images/public/somerights30.png";</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
* For using [[w:Resource Description Framework|RDF metadata]] about copyright add one or both of the following lines to your <code>LocalSettings.php</code>:
</div>
<syntaxhighlight lang="php" style="overflow:auto;">
$wgEnableCreativeCommonsRdf = true;
$wgEnableDublinCoreRdf = true;
</syntaxhighlight>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Custom namespaces===
</div>
<span lang="en" dir="ltr" class="mw-content-ltr">By declaring '''{{ll|Manual:$wgExtraNamespaces|$wgExtraNamespaces}}''', and modifying '''{{ll|Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages}}''', and '''{{ll|Manual:$wgNamespacesToBeSearchedDefault|$wgNamespacesToBeSearchedDefault}}''', extra namespaces can be added to a MediaWiki installation; and by declaring the '''{{ll|Manual:$wgNamespaceAliases|$wgNamespaceAliases}}''' array namespace aliases can be added.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">'''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.</span>
<span lang="en" dir="ltr" class="mw-content-ltr">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".</span>
<span lang="en" dir="ltr" class="mw-content-ltr">See {{ll|Manual:Using custom namespaces|Custom namespaces}} for more information as to how to do so.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
===Skins===
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
The default skin of the site can be modified via '''{{ll|Manual:$wgDefaultSkin|$wgDefaultSkin}}'''.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
==See also==
</div>
*{{file doclink |LocalSettingsGenerator}} <span lang="en" dir="ltr" class="mw-content-ltr">source code, which generates the inital contents of <code>LocalSettings.php</code> during installation.</span>
<div lang="en" dir="ltr" class="mw-content-ltr">
*[[Special:MyLanguage/Manual:Wiki family|Wiki families]] can share the same {{BASEPAGENAME}}.
</div>
*{{ll|Manual:Securing database passwords}} - <span lang="en" dir="ltr" class="mw-content-ltr">a guide to securing your database passwords and <code>LocalSettings.php</code> file.</span>
[[Category:MediaWiki configuration{{#translation:}}| ]]

Revision as of 20:08, 31 October 2022

Файл LocalSettings.php содержит базовые параметры конфигурации (на основе файла Template:Ll) установки MediaWiki. 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 Template:Ll may be used.