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