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