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