]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/templates/default/LocalSettings.php.erb
b7788396f4cd4ad180007c7f9623ddc4fded42ce
[chef.git] / cookbooks / mediawiki / templates / default / LocalSettings.php.erb
1 <?php
2 # DO NOT EDIT - This file is being maintained by Chef
3
4 # Protect against web entry
5 if ( !defined( 'MEDIAWIKI' ) ) {
6         exit;
7 }
8
9 ## Uncomment this to disable output compression
10 # $wgDisableOutputCompression = true;
11
12 $wgSitename      = '<%= @mediawiki[:sitename] %>';
13 $wgMetaNamespace = '<%= @mediawiki[:metanamespace] %>';
14
15 ## The URL base path to the directory containing the wiki;
16 ## defaults for all runtime URL paths are based off of this.
17 ## For more information on customizing the URLs
18 ## (like /w/index.php/Page_title to /wiki/Page_title) please see:
19 ## https://www.mediawiki.org/wiki/Manual:Short_URL
20 $wgScriptPath       = "/w";
21 $wgArticlePath      = '/wiki/$1';
22 $wgUsePathInfo      = true;
23 $wgScriptExtension  = ".php";
24
25 ## The protocol and server name to use in fully-qualified URLs
26 $wgServer           = "//<%= @name %>";
27 $wgInternalServer   = 'https://<%= @name %>';
28 $wgCanonicalServer  = 'https://<%= @name %>';
29
30 $wgSecureLogin = true;
31 $wgDefaultUserOptions['prefershttps'] = 1;
32 $wgCookieSecure = true;
33
34 ## The relative URL path to the skins directory
35 $wgStylePath        = "$wgScriptPath/skins";
36
37 ## The relative URL path to the logo.  Make sure you change this from the default,
38 ## or else you'll overwrite your logo when you upgrade!
39 $wgLogo             = "<%= @mediawiki[:logo] %>";
40
41 ## UPO means: this is also a user preference option
42
43 $wgEnableEmail      = true;
44 $wgEnableUserEmail  = true; # UPO
45
46 $wgEmergencyContact = "<%= @mediawiki[:email_contact] %>";
47 $wgPasswordSender   = "<%= @mediawiki[:email_sender] %>";
48 $wgPasswordSenderName = "<%= @mediawiki[:email_sender_name] %>"; //Replaced by MediaWiki:Emailsender in v1.23.0
49 $wgNoReplyAddress = "<%= @mediawiki[:email_sender] %>";
50
51 $wgEnotifUserTalk      = true; # UPO
52 $wgEnotifWatchlist     = true; # UPO
53 $wgEmailAuthentication = true;
54
55 $wgEnotifUseJobQ       = true;
56
57 $wgSMTP = [
58   "host" => "localhost",
59   "socket_options" => [
60     "ssl" => [
61       "verify_peer_name" => false
62     ]
63   ]
64 ];
65
66 ## Database settings
67 $wgDBtype           = "mysql";
68 $wgDBserver         = "<%= @database_params[:host] %>";
69 $wgDBname           = "<%= @database_params[:name] %>";
70 $wgDBuser           = "<%= @database_params[:username] %>";
71 $wgDBpassword       = "<%= @database_params[:password] %>";
72
73 # MySQL specific settings
74 $wgDBprefix         = "";
75
76 # MySQL table options to use during installation or update
77 $wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
78
79 # Experimental charset support for MySQL 5.0.
80 $wgDBmysql5 = false;
81
82 ## Shared memory settings
83 $wgMainCacheType    = CACHE_MEMCACHED;
84 $wgParserCacheType  = CACHE_MEMCACHED;
85 $wgMessageCacheType = CACHE_MEMCACHED;
86 $wgSessionCacheType = CACHE_MEMCACHED;
87 $wgMemCachedServers = array('127.0.0.1:11211');
88 $wgSessionsInObjectCache = TRUE;
89
90 ## To enable image uploads, make sure the 'images' directory
91 ## is writable, then set this to true:
92 $wgEnableUploads  = true;
93 $wgUseImageMagick = true;
94 $wgImageMagickConvertCommand = "/usr/bin/convert";
95
96 $wgGenerateThumbnailOnParse = false;
97 $wgMaxImageArea = 125000000;
98 $wgMaxShellMemory = 5524000;
99 $wgMaxShellFileSize = 819200;
100 $wgMaxShellTime = 360;
101 $wgMaxShellWallClockTime = 360;
102
103 # Allow some more upload extensions
104 $wgFileExtensions[] = 'pdf';
105 $wgFileExtensions[] = 'odt';
106 $wgFileExtensions[] = 'odp';
107 $wgFileExtensions[] = 'ods';
108 $wgFileExtensions[] = 'svg';
109 $wgFileExtensions[] = 'osm';
110 $wgFileExtensions[] = 'odg';
111 <% @mediawiki[:extra_file_extensions].each do |mw_extra_file_extension| -%>
112         $wgFileExtensions[] = '<%= mw_extra_file_extension %>';
113 <% end -%>
114
115 # Add OSM XML file format per http://www.iana.org/assignments/media-types/media-types.xhtml
116 # Shout out to Paul Norman for reserving this.
117 # Helps MimeMagic determine XML-based formats and chooses the correct MimeType
118 # for .osm files.
119 $wgXMLMimeTypes[] = array('osm' => 'application/vnd.openstreetmap.data+xml');
120
121 $wgTrustedMediaFormats[] = 'application/vnd.openstreetmap.data+xml';
122
123 $wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height -o $output $input');
124 $wgSVGConverter = 'rsvg';
125 $wgSVGMaxSize = 2000;
126
127 ## If you use ImageMagick (or any other shell command) on a
128 ## Linux server, this will need to be set to the name of an
129 ## available UTF-8 locale
130 $wgShellLocale = "en_US.utf8";
131
132 ## If you want to use image uploads under safe mode,
133 ## create the directories images/archive, images/thumb and
134 ## images/temp, and make them all writable. Then uncomment
135 ## this, if it's not already uncommented:
136 #$wgHashedUploadDirectory = false;
137
138 ## Set $wgCacheDirectory to a writable directory on the web server
139 ## to make your wiki go slightly faster. The directory should not
140 ## be publically accessible from the web.
141 #$wgCacheDirectory = "$IP/cache";
142
143 # Site language code, should be one of the list in ./languages/Names.php
144 $wgLanguageCode = "en";
145
146 ## Enable setting the page content language by users
147 $wgPageLanguageUseDB = true;
148 $wgGroupPermissions['user']['pagelang'] = true;
149
150 $wgSecretKey = '<%= @secret_key %>';
151
152 # Site upgrade key. Must be set to a string (default provided) to turn on the
153 # web installer while LocalSettings.php is in place
154 #$wgUpgradeKey = "6ad907e74fc65836";
155
156 ## Default skin: you can change the default skin. Use the internal symbolic
157 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
158 $wgDefaultSkin = "<%= @mediawiki[:skin] %>";
159
160 ## For attaching licensing metadata to pages, and displaying an
161 ## appropriate copyright notice / icon. GNU Free Documentation
162 ## License and Creative Commons licenses are supported so far.
163 $wgRightsPage = "Wiki_content_license"; # Set to the title of a wiki page that describes your license/copyright
164 $wgRightsUrl  = "https://creativecommons.org/licenses/by-sa/2.0/";
165 $wgRightsText = "Creative Commons Attribution-ShareAlike 2.0 license";
166 $wgRightsIcon = "/cc-wiki.png";
167
168 # Path to the GNU diff3 utility. Used for conflict resolution.
169 $wgDiff3 = "/usr/bin/diff3";
170
171 $wgExternalDiffEngine = 'wikidiff2';
172
173 # Query string length limit for ResourceLoader. You should only set this if
174 # your web server has a query string length limit (then set it to that limit),
175 # or if you have suhosin.get.max_value_length set in php.ini (then set it to
176 # that value)
177 $wgResourceLoaderMaxQueryLength = -1;
178
179 # End of automatically generated settings.
180 # Add more configuration options below.
181
182 # Only Allow Signed-in users to edit
183 $wgGroupPermissions['*']['edit'] = false;
184
185 # Allow bureaucrat group access to oversight options
186 $wgGroupPermissions['bureaucrat']['hideuser'] = true;
187 $wgGroupPermissions['bureaucrat']['deletelogentry'] = true;
188 $wgGroupPermissions['bureaucrat']['deleterevision'] = true;
189 $wgGroupPermissions['bureaucrat']['suppressrevision'] = true;
190 $wgGroupPermissions['bureaucrat']['suppressionlog'] = true;
191
192 # Since 1.32 MW introduced interface-admin group to separate all UI-related rights. This makes sense for bigger sites,
193 # but for OSM it makes more sense to keep group structure simple.  Give all interface-admin rights to sysops.
194 # Also remove the interface-admin group to avoid confusion.
195 $wgGroupPermissions['sysop'] = array_merge( $wgGroupPermissions['sysop'], $wgGroupPermissions['interface-admin'] );
196 unset( $wgGroupPermissions['interface-admin'] );
197 unset( $wgRevokePermissions['interface-admin'] );
198 unset( $wgAddGroups['interface-admin'] );
199 unset( $wgRemoveGroups['interface-admin'] );
200 unset( $wgGroupsAddToSelf['interface-admin'] );
201 unset( $wgGroupsRemoveFromSelf['interface-admin'] );
202
203 # The v1.32+ gadget system also requires two additional rights
204 # See https://www.mediawiki.org/wiki/Extension:Gadgets
205 $wgGroupPermissions['sysop']['gadgets-edit'] = true;
206 $wgGroupPermissions['sysop']['gadgets-definition-edit'] = true;
207
208 <% if @mediawiki[:private_accounts] -%>
209 # Prevent new user registrations except by existing users
210 $wgGroupPermissions['*']['createaccount'] = false;
211 $wgGroupPermissions['user']['createaccount'] = true;
212 <% end -%>
213
214 <% if @mediawiki[:private_site] -%>
215 # Disable reading by anonymous users
216 $wgGroupPermissions['*']['read'] = false;
217
218 # Allow anonymous users to access the login page
219 $wgWhitelistRead = array ("Special:Userlogin");
220
221 # Prevent new user registrations except by sysops
222 $wgGroupPermissions['*']['createaccount'] = false;
223
224 # Restrict access to the upload directory
225 $wgUploadPath = "$wgScriptPath/img_auth.php";
226 <% end -%>
227
228 # Allow Subpages on Main Namespace
229 $wgNamespacesWithSubpages[NS_MAIN] = true;
230
231 # DNS Blacklists to use
232 $wgEnableDnsBlacklist = true;
233 $wgDnsBlacklistUrls = [
234   'proxies.dnsbl.sorbs.net.',
235   'opm.tornevall.org.',
236   'xbl.spamhaus.org.',
237   'dnsbl-2.uceprotect.net.'
238 ];
239
240 # Require validated email to edit
241 $wgEmailConfirmToEdit = true;
242
243 # Extend autoblock period
244 $wgAutoblockExpiry = 7776000; // 90 days
245
246 # Disable Hit Counter for Performance
247 $wgDisableCounters = TRUE;
248 # Disable IP in Header to avoid cache issue
249 $wgShowIPinHeader = FALSE;
250
251 # Job Runs by cron
252 $wgJobRunRate = 0;
253
254 # dissolves double redirects automatically
255 $wgFixDoubleRedirects = TRUE;
256
257 # Allow external images from a few sites
258 $wgAllowExternalImagesFrom = [
259   'http://tile.openstreetmap.org/',
260   'https://tile.openstreetmap.org',
261   'http://josm.openstreetmap.de/'
262 ];
263
264 $wgNoFollowDomainExceptions = [
265   'www.openstreetmap.org',
266   'josm.openstreetmap.de',
267   'taginfo.openstreetmap.org',
268   'blog.openstreetmap.org',
269   'forum.openstreetmap.org',
270   'community.openstreetmap.org',
271   'lists.openstreetmap.org',
272   'help.openstreetmap.org',
273   'switch2osm.org',
274   'wiki.osmfoundation.org',
275   'www.openstreetmap.us',
276   'learnosm.org',
277   'nominatim.org',
278   'openstreetmap.community',
279   'www.openstreetbrowser.org',
280   'openinframap.org',
281   'leafletjs.com'
282 ];
283
284 # FIXME - move to specific
285 $wgAllowUserJs = TRUE;
286 $wgAllowUserCss = TRUE;
287
288 # Raise expensive lua (and other function) call limits to match WP
289 # Docs:  https://www.mediawiki.org/wiki/Manual:$wgExpensiveParserFunctionLimit
290 # Wikipedia's Config:  https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php
291 $wgExpensiveParserFunctionLimit = 500;
292
293
294 <% if @mediawiki[:site_notice] -%>
295 $wgSiteNotice = "<%= @mediawiki[:site_notice] %>";
296 <% end -%>
297 <% if @mediawiki[:site_readonly] -%>
298 $wgReadOnly = "<%= @mediawiki[:site_readonly] %>";
299 <% end -%>
300
301 <% if @name == "wiki.openstreetmap.org" -%>
302 # DE
303 define('NS_LANG_DE', 200);
304 $wgExtraNamespaces[NS_LANG_DE] = 'DE';
305 $wgNamespacesWithSubpages[NS_LANG_DE] = TRUE;
306 $wgContentNamespaces[] = NS_LANG_DE;
307 define('NS_LANG_DE_TALK', 201);
308 $wgExtraNamespaces[NS_LANG_DE_TALK] = 'DE_talk';
309 $wgNamespacesWithSubpages[NS_LANG_DE_TALK] = TRUE;
310
311 # FR
312 define('NS_LANG_FR', 202);
313 $wgExtraNamespaces[NS_LANG_FR] = 'FR';
314 $wgNamespacesWithSubpages[NS_LANG_FR] = TRUE;
315 $wgContentNamespaces[] = NS_LANG_FR;
316 define('NS_LANG_FR_TALK', 203);
317 $wgExtraNamespaces[NS_LANG_FR_TALK] = 'FR_talk';
318 $wgNamespacesWithSubpages[NS_LANG_FR_TALK] = TRUE;
319
320 # ES
321 define('NS_LANG_ES', 204);
322 $wgExtraNamespaces[NS_LANG_ES] = 'ES';
323 $wgNamespacesWithSubpages[NS_LANG_ES] = TRUE;
324 $wgContentNamespaces[] = NS_LANG_ES;
325 define('NS_LANG_ES_TALK', 205);
326 $wgExtraNamespaces[NS_LANG_ES_TALK] = 'ES_talk';
327 $wgNamespacesWithSubpages[NS_LANG_ES_TALK] = TRUE;
328
329 # IT
330 define('NS_LANG_IT', 206);
331 $wgExtraNamespaces[NS_LANG_IT] = 'IT';
332 $wgNamespacesWithSubpages[NS_LANG_IT] = TRUE;
333 $wgContentNamespaces[] = NS_LANG_IT;
334 define('NS_LANG_IT_TALK', 207);
335 $wgExtraNamespaces[NS_LANG_IT_TALK] = 'IT_talk';
336 $wgNamespacesWithSubpages[NS_LANG_IT_TALK] = TRUE;
337
338 # NL
339 define('NS_LANG_NL', 208);
340 $wgExtraNamespaces[NS_LANG_NL] = 'NL';
341 $wgNamespacesWithSubpages[NS_LANG_NL] = TRUE;
342 $wgContentNamespaces[] = NS_LANG_NL;
343 define('NS_LANG_NL_TALK', 209);
344 $wgExtraNamespaces[NS_LANG_NL_TALK] = 'NL_talk';
345 $wgNamespacesWithSubpages[NS_LANG_NL_TALK] = TRUE;
346
347 # RU
348 define('NS_LANG_RU', 210);
349 $wgExtraNamespaces[NS_LANG_RU] = 'RU';
350 $wgNamespacesWithSubpages[NS_LANG_RU] = TRUE;
351 $wgContentNamespaces[] = NS_LANG_RU;
352 define('NS_LANG_RU_TALK', 211);
353 $wgExtraNamespaces[NS_LANG_RU_TALK] = 'RU_talk';
354 $wgNamespacesWithSubpages[NS_LANG_RU_TALK] = TRUE;
355
356 # JA
357 define('NS_LANG_JA', 212);
358 $wgExtraNamespaces[NS_LANG_JA] = 'JA';
359 $wgNamespacesWithSubpages[NS_LANG_JA] = TRUE;
360 $wgContentNamespaces[] = NS_LANG_JA;
361 define('NS_LANG_JA_TALK', 213);
362 $wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk';
363 $wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE;
364
365 # Proposal
366 # namespace features a specific search weight defined at
367 # cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb
368 define('NS_PROPOSAL', 3000);
369 $wgExtraNamespaces[NS_PROPOSAL] = 'Proposal';
370 $wgNamespacesWithSubpages[NS_PROPOSAL] = TRUE;
371 $wgContentNamespaces[] = NS_PROPOSAL;
372 define('NS_PROPOSAL_TALK', 3001);
373 $wgExtraNamespaces[NS_PROPOSAL_TALK] = 'Proposal_talk';
374 $wgNamespacesWithSubpages[NS_PROPOSAL_TALK] = TRUE;
375
376 $wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE;
377 $wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE;
378 $wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE;
379 $wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE;
380 $wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE;
381 $wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE;
382 $wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE;
383 $wgNamespacesToBeSearchedDefault[NS_PROPOSAL] = TRUE;
384
385 # defines which links of the sidebar are translatable
386 $wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'mapfeatures-url', 'contributors-url', 'helppage', 'blogs-url', 'shop-url', 'sitesupport-url' );
387 <% end -%>
388
389 # load extensions
390 <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%>
391 <%= "require_once('#{file}');" %>
392 <% end -%>
393
394 <% if @name == "wiki.openstreetmap.org" -%>
395 # Placeholder for the wiki.openstreetmap.org specific config
396 <% end -%>
397
398 <% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%>
399 # require user confirmation for certain actions
400 $wgGroupPermissions['user']['move'] = false;
401 $wgGroupPermissions['user']['movefile'] = false;
402 $wgGroupPermissions['user']['move-categorypages'] = false;
403 $wgGroupPermissions['user']['upload'] = false;
404 $wgGroupPermissions['autoconfirmed']['move'] = true;
405 $wgGroupPermissions['autoconfirmed']['movefile'] = true;
406 $wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
407 $wgGroupPermissions['autoconfirmed']['upload'] = true;
408 # Autopromote users to autoconfirmed
409 $wgAutoConfirmAge = 345600; // 4 days
410 $wgAutoConfirmCount = 10;
411
412 # user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops
413 $wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed'];
414 $wgAddGroups['sysop'][] = 'confirmed';
415 $wgRemoveGroups['sysop'][] = 'confirmed';
416 <% end -%>
417
418 <% if @mediawiki[:private_accounts] or @mediawiki[:private_site] -%>
419 # disable automatic confirmation of users, grant all "autoconfirmed" rights to all users
420 $wgAutoConfirmAge = 0;
421 $wgAutoConfirmCount = 0;
422 $wgGroupPermissions['user'] = array_merge( $wgGroupPermissions['user'], $wgGroupPermissions['autoconfirmed'] );
423
424 unset( $wgGroupPermissions['autoconfirmed'] );
425 unset( $wgRevokePermissions['autoconfirmed'] );
426 unset( $wgAddGroups['autoconfirmed'] );
427 unset( $wgRemoveGroups['autoconfirmed'] );
428 unset( $wgGroupsAddToSelf['autoconfirmed'] );
429 unset( $wgGroupsRemoveFromSelf['autoconfirmed'] );
430 <% end -%>
431
432 # Increase curl timeout to allow parsoid requests to heavy pages like Map Features
433 # Mediawiki 1.38 has fix to allow this to be set by $wgVirtualRestConfig
434 # https://phabricator.wikimedia.org/T285478
435 $wgHTTPTimeout = 240;