]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/templates/default/LocalSettings.php.erb
establish confirmed user's group in public wikis
[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[] = 'doc';
93 $wgFileExtensions[] = 'pdf';
94 $wgFileExtensions[] = 'odt';
95 $wgFileExtensions[] = 'odp';
96 $wgFileExtensions[] = 'ods';
97 $wgFileExtensions[] = 'svg';
98 $wgFileExtensions[] = 'osm';
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 # InstantCommons allows wiki to use images from https://commons.wikimedia.org
116 <% if @mediawiki[:commons] -%>
117 $wgUseInstantCommons  = true;
118 <% else -%>
119 $wgUseInstantCommons  = false;
120 <% end -%>
121
122 ## If you use ImageMagick (or any other shell command) on a
123 ## Linux server, this will need to be set to the name of an
124 ## available UTF-8 locale
125 $wgShellLocale = "en_US.utf8";
126
127 ## If you want to use image uploads under safe mode,
128 ## create the directories images/archive, images/thumb and
129 ## images/temp, and make them all writable. Then uncomment
130 ## this, if it's not already uncommented:
131 #$wgHashedUploadDirectory = false;
132
133 ## Set $wgCacheDirectory to a writable directory on the web server
134 ## to make your wiki go slightly faster. The directory should not
135 ## be publically accessible from the web.
136 #$wgCacheDirectory = "$IP/cache";
137
138 # Site language code, should be one of the list in ./languages/Names.php
139 $wgLanguageCode = "en";
140
141 ## Enable setting the page content language by users
142 $wgPageLanguageUseDB = true;
143 $wgGroupPermissions['user']['pagelang'] = true;
144
145 $wgSecretKey = '<%= @secret_key %>';
146
147 # Site upgrade key. Must be set to a string (default provided) to turn on the
148 # web installer while LocalSettings.php is in place
149 #$wgUpgradeKey = "6ad907e74fc65836";
150
151 ## Default skin: you can change the default skin. Use the internal symbolic
152 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
153 $wgDefaultSkin = "<%= @mediawiki[:skin] %>";
154
155 ## For attaching licensing metadata to pages, and displaying an
156 ## appropriate copyright notice / icon. GNU Free Documentation
157 ## License and Creative Commons licenses are supported so far.
158 $wgRightsPage = "Wiki_content_license"; # Set to the title of a wiki page that describes your license/copyright
159 $wgRightsUrl  = "https://creativecommons.org/licenses/by-sa/2.0/";
160 $wgRightsText = "Creative Commons Attribution-ShareAlike 2.0 license";
161 $wgRightsIcon = "/cc-wiki.png";
162
163 # Path to the GNU diff3 utility. Used for conflict resolution.
164 $wgDiff3 = "/usr/bin/diff3";
165
166 $wgExternalDiffEngine = 'wikidiff2';
167
168 # Query string length limit for ResourceLoader. You should only set this if
169 # your web server has a query string length limit (then set it to that limit),
170 # or if you have suhosin.get.max_value_length set in php.ini (then set it to
171 # that value)
172 $wgResourceLoaderMaxQueryLength = -1;
173
174 # End of automatically generated settings.
175 # Add more configuration options below.
176
177 # Only Allow Signed-in users to edit
178 $wgGroupPermissions['*']['edit'] = false;
179
180 # Only allow autoconfirmed for a few actions
181 $wgGroupPermissions['user']['move'] = false;
182 $wgGroupPermissions['user']['movefile'] = false;
183 $wgGroupPermissions['user']['move-categorypages'] = false;
184 $wgGroupPermissions['user']['upload'] = false;
185 $wgGroupPermissions['autoconfirmed']['move'] = true;
186 $wgGroupPermissions['autoconfirmed']['movefile'] = true;
187 $wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
188 $wgGroupPermissions['autoconfirmed']['upload'] = true;
189
190 # Allow bureaucrat group access to oversight options
191 $wgGroupPermissions['bureaucrat']['hideuser'] = true;
192 $wgGroupPermissions['bureaucrat']['deletelogentry'] = true;
193 $wgGroupPermissions['bureaucrat']['deleterevision'] = true;
194 $wgGroupPermissions['bureaucrat']['suppressrevision'] = true;
195 $wgGroupPermissions['bureaucrat']['suppressionlog'] = true;
196
197 # Since 1.32 MW introduced interface-admin group to separate all UI-related rights. This makes sense for bigger sites,
198 # but for OSM it makes more sense to keep group structure simple.  Give all interface-admin rights to sysops.
199 # Also remove the interface-admin group to avoid confusion.
200 $wgGroupPermissions['sysop'] = array_merge( $wgGroupPermissions['sysop'], $wgGroupPermissions['interface-admin'] );
201 unset( $wgGroupPermissions['interface-admin'] );
202 unset( $wgRevokePermissions['interface-admin'] );
203 unset( $wgAddGroups['interface-admin'] );
204 unset( $wgRemoveGroups['interface-admin'] );
205 unset( $wgGroupsAddToSelf['interface-admin'] );
206 unset( $wgGroupsRemoveFromSelf['interface-admin'] );
207
208 # The v1.32+ gadget system also requires two additional rights
209 # See https://www.mediawiki.org/wiki/Extension:Gadgets
210 $wgGroupPermissions['sysop']['gadgets-edit'] = true;
211 $wgGroupPermissions['sysop']['gadgets-definition-edit'] = true;
212
213 <% if @mediawiki[:private_accounts] -%>
214 # Prevent new user registrations except by existing users
215 $wgGroupPermissions['*']['createaccount'] = false;
216 $wgGroupPermissions['user']['createaccount'] = true;
217 <% end -%>
218 <% if @mediawiki[:private_site] -%>
219
220 # Disable reading by anonymous users
221 $wgGroupPermissions['*']['read'] = false;
222
223 # Allow anonymous users to access the login page
224 $wgWhitelistRead = array ("Special:Userlogin");
225
226 # Prevent new user registrations except by sysops
227 $wgGroupPermissions['*']['createaccount'] = false;
228
229 # Restrict access to the upload directory
230 $wgUploadPath = "$wgScriptPath/img_auth.php";
231 <% end -%>
232
233 <% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%>
234 # user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops
235 $wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed'];
236 $wgAddGroups['sysop'][] = 'confirmed';
237 $wgRemoveGroups['sysop'][] = 'confirmed';
238 <% end -%>
239
240 # Allow Subpages on Main Namespace
241 $wgNamespacesWithSubpages[NS_MAIN] = true;
242
243 # DNS Blacklists to use
244 $wgEnableDnsBlacklist = true;
245 $wgDnsBlacklistUrls = array( 'proxies.dnsbl.sorbs.net.', 'opm.tornevall.org.', 'xbl.spamhaus.org.', 'dnsbl-2.uceprotect.net.' );
246
247 # Require validated email to edit
248 $wgEmailConfirmToEdit = true;
249
250 # Extend autoblock period
251 $wgAutoblockExpiry = 7776000; // 90 days
252
253 # Spam filter regex
254 $wgSpamRegex = '/\b(gmail|dell|asus|eps(o|0)n|br(o|0)ther|can(o|0)n|hp|k(o|0)dak|lexmark|mcafee|bitdefender|n(o|0)rt(o|0)n( 360)?|avira|kaspersky|avg|avast|micr(o|0)s(o|0)ft|(o|0)utl(o|0)(o|0)k|printer|netgear( r(o|0)uter)?|quickb(o|0)(o|0)ks( payr(o|0)ll)?)( antivirus)?( helpline| cust(o|0)mer|( technical| tech)| cust(o|0)mer service)? (supp(o|0)rt number|ph(o|0)ne number|supp(o|0)rt ph(o|0)ne number|care number|helpdesk number)\b/i';
255
256 # Autopromote users to autoconfirmed
257 $wgAutoConfirmAge = 345600; // 4 days
258 $wgAutoConfirmCount = 10;
259
260 # Disable Hit Counter for Performance
261 $wgDisableCounters = TRUE;
262 # Disable IP in Header to avoid cache issue
263 $wgShowIPinHeader = FALSE;
264
265 # Job Runs mostly by cron
266 $wgJobRunRate = 0.01;
267
268 # dissolves double redirects automatically
269 $wgFixDoubleRedirects = TRUE;
270
271 # Allow external images from a few sites
272 $wgAllowExternalImagesFrom = array( 'http://tile.openstreetmap.org/', 'https://tile.openstreetmap.org', 'http://josm.openstreetmap.de/', 'http://trac.openstreetmap.org/', 'http://rweait.dev.openstreetmap.org/' );
273
274 $wgNoFollowDomainExceptions = array( 'www.openstreetmap.org', 'josm.openstreetmap.de', 'taginfo.openstreetmap.org', 'blog.openstreetmap.org', 'wiki.osmfoundation.org' );
275
276 # FIXME - move to specific
277 $wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'portal-url', 'mapfeatures-url', 'helppage' );
278
279 # FIXME - move to specific
280 $wgAllowUserJs = TRUE;
281 $wgAllowUserCss = TRUE;
282
283 # FIXME - move to specific
284 # DE
285 define('NS_LANG_DE', 200);
286 $wgExtraNamespaces[NS_LANG_DE] = 'DE';
287 $wgNamespacesWithSubpages[NS_LANG_DE] = TRUE;
288 $wgContentNamespaces[] = NS_LANG_DE;
289 define('NS_LANG_DE_TALK', 201);
290 $wgExtraNamespaces[NS_LANG_DE_TALK] = 'DE_talk';
291 $wgNamespacesWithSubpages[NS_LANG_DE_TALK] = TRUE;
292
293 # FR
294 define('NS_LANG_FR', 202);
295 $wgExtraNamespaces[NS_LANG_FR] = 'FR';
296 $wgNamespacesWithSubpages[NS_LANG_FR] = TRUE;
297 $wgContentNamespaces[] = NS_LANG_FR;
298 define('NS_LANG_FR_TALK', 203);
299 $wgExtraNamespaces[NS_LANG_FR_TALK] = 'FR_talk';
300 $wgNamespacesWithSubpages[NS_LANG_FR_TALK] = TRUE;
301
302 # ES
303 define('NS_LANG_ES', 204);
304 $wgExtraNamespaces[NS_LANG_ES] = 'ES';
305 $wgNamespacesWithSubpages[NS_LANG_ES] = TRUE;
306 $wgContentNamespaces[] = NS_LANG_ES;
307 define('NS_LANG_ES_TALK', 205);
308 $wgExtraNamespaces[NS_LANG_ES_TALK] = 'ES_talk';
309 $wgNamespacesWithSubpages[NS_LANG_ES_TALK] = TRUE;
310
311 # IT
312 define('NS_LANG_IT', 206);
313 $wgExtraNamespaces[NS_LANG_IT] = 'IT';
314 $wgNamespacesWithSubpages[NS_LANG_IT] = TRUE;
315 $wgContentNamespaces[] = NS_LANG_IT;
316 define('NS_LANG_IT_TALK', 207);
317 $wgExtraNamespaces[NS_LANG_IT_TALK] = 'IT_talk';
318 $wgNamespacesWithSubpages[NS_LANG_IT_TALK] = TRUE;
319
320 # NL
321 define('NS_LANG_NL', 208);
322 $wgExtraNamespaces[NS_LANG_NL] = 'NL';
323 $wgNamespacesWithSubpages[NS_LANG_NL] = TRUE;
324 $wgContentNamespaces[] = NS_LANG_NL;
325 define('NS_LANG_NL_TALK', 209);
326 $wgExtraNamespaces[NS_LANG_NL_TALK] = 'NL_talk';
327 $wgNamespacesWithSubpages[NS_LANG_NL_TALK] = TRUE;
328
329 # RU
330 define('NS_LANG_RU', 210);
331 $wgExtraNamespaces[NS_LANG_RU] = 'RU';
332 $wgNamespacesWithSubpages[NS_LANG_RU] = TRUE;
333 $wgContentNamespaces[] = NS_LANG_RU;
334 define('NS_LANG_RU_TALK', 211);
335 $wgExtraNamespaces[NS_LANG_RU_TALK] = 'RU_talk';
336 $wgNamespacesWithSubpages[NS_LANG_RU_TALK] = TRUE;
337
338 # JA
339 define('NS_LANG_JA', 212);
340 $wgExtraNamespaces[NS_LANG_JA] = 'JA';
341 $wgNamespacesWithSubpages[NS_LANG_JA] = TRUE;
342 $wgContentNamespaces[] = NS_LANG_JA;
343 define('NS_LANG_JA_TALK', 213);
344 $wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk';
345 $wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE;
346
347 $wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE;
348 $wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE;
349 $wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE;
350 $wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE;
351 $wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE;
352 $wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE;
353 $wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE;
354
355
356 # Raise expensive lua (and other function) call limits to match WP
357 # Docs:  https://www.mediawiki.org/wiki/Manual:$wgExpensiveParserFunctionLimit
358 # Wikipedia's Config:  https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php
359 $wgExpensiveParserFunctionLimit = 500;
360
361
362 <% if @mediawiki[:site_notice] -%>
363 $wgSiteNotice = "<%= @mediawiki[:site_notice] %>";
364 <% end -%>
365 <% if @mediawiki[:site_readonly] -%>
366 $wgReadOnly = "<%= @mediawiki[:site_readonly] %>";
367 <% end -%>
368
369 <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%>
370 <%= "require_once('#{file}');" %>
371 <% end -%>