2 # DO NOT EDIT - This file is being maintained by Chef
4 # Protect against web entry
5 if ( !defined( 'MEDIAWIKI' ) ) {
9 ## Uncomment this to disable output compression
10 # $wgDisableOutputCompression = true;
12 $wgSitename = '<%= @mediawiki[:sitename] %>';
13 $wgMetaNamespace = '<%= @mediawiki[:metanamespace] %>';
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
21 $wgArticlePath = '/wiki/$1';
22 $wgUsePathInfo = true;
23 $wgScriptExtension = ".php";
25 ## The protocol and server name to use in fully-qualified URLs
26 $wgServer = "//<%= @name %>";
27 $wgInternalServer = 'https://<%= @name %>';
28 $wgCanonicalServer = 'https://<%= @name %>';
29 $wgHTTPUserAgentContact = 'https://<%= @name %>'; // New in 1.46.1
31 $wgSecureLogin = true;
32 $wgDefaultUserOptions['prefershttps'] = 1;
33 $wgCookieSecure = true;
35 ## The relative URL path to the skins directory
36 $wgStylePath = "$wgScriptPath/skins";
38 ## The relative URL path to the logo. Make sure you change this from the default,
39 ## or else you'll overwrite your logo when you upgrade!
40 $wgLogo = "<%= @mediawiki[:logo] %>";
42 "icon" => "<%= @mediawiki[:logo] %>"
45 ## UPO means: this is also a user preference option
47 $wgEnableEmail = true;
48 $wgEnableUserEmail = true; # UPO
50 $wgEmergencyContact = "<%= @mediawiki[:email_contact] %>";
51 $wgPasswordSender = "<%= @mediawiki[:email_sender] %>";
52 $wgPasswordSenderName = "<%= @mediawiki[:email_sender_name] %>"; // Replaced by MediaWiki:Emailsender in v1.23.0
53 $wgNoReplyAddress = "<%= @mediawiki[:email_sender] %>";
55 $wgEnotifUserTalk = true; # UPO
56 $wgEnotifWatchlist = true; # UPO
57 $wgEmailAuthentication = true;
59 $wgEnotifUseJobQ = true;
62 "host" => "localhost",
65 "verify_peer_name" => false
72 $wgDBserver = "<%= @database_params[:host] %>";
73 $wgDBname = "<%= @database_params[:name] %>";
74 $wgDBuser = "<%= @database_params[:username] %>";
75 $wgDBpassword = "<%= @database_params[:password] %>";
77 # MySQL specific settings
80 # MySQL table options to use during installation or update
81 $wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
83 # Experimental charset support for MySQL 5.0.
86 ## Shared memory settings
87 $wgMainCacheType = CACHE_MEMCACHED;
88 $wgParserCacheType = CACHE_MEMCACHED;
89 $wgMessageCacheType = CACHE_MEMCACHED;
90 $wgSessionCacheType = CACHE_MEMCACHED;
91 $wgMemCachedServers = array('127.0.0.1:11211');
92 $wgSessionsInObjectCache = TRUE;
94 ## To enable image uploads, make sure the 'images' directory
95 ## is writable, then set this to true:
96 $wgEnableUploads = true;
97 $wgUseImageMagick = true;
98 $wgImageMagickConvertCommand = "/usr/bin/convert";
100 $wgGenerateThumbnailOnParse = false;
101 $wgMaxImageArea = 125000000;
102 $wgMaxShellMemory = 5524000;
103 $wgMaxShellFileSize = 819200;
104 $wgMaxShellTime = 360;
105 $wgMaxShellWallClockTime = 360;
107 # Allow some more upload extensions
108 $wgFileExtensions[] = 'pdf';
109 $wgFileExtensions[] = 'odt';
110 $wgFileExtensions[] = 'odp';
111 $wgFileExtensions[] = 'ods';
112 $wgFileExtensions[] = 'svg';
113 $wgFileExtensions[] = 'osm';
114 $wgFileExtensions[] = 'odg';
115 <% @mediawiki[:extra_file_extensions].each do |mw_extra_file_extension| -%>
116 $wgFileExtensions[] = '<%= mw_extra_file_extension %>';
119 # Add OSM XML file format per http://www.iana.org/assignments/media-types/media-types.xhtml
120 # Shout out to Paul Norman for reserving this.
121 # Helps MimeMagic determine XML-based formats and chooses the correct MimeType
123 $wgXMLMimeTypes[] = array('osm' => 'application/vnd.openstreetmap.data+xml');
125 $wgTrustedMediaFormats[] = 'application/vnd.openstreetmap.data+xml';
127 $wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height -o $output $input');
128 $wgSVGConverter = 'rsvg';
129 $wgSVGMaxSize = 2000;
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";
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;
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";
147 # Site language code, should be one of the list in ./languages/Names.php
148 $wgLanguageCode = "en";
150 ## Enable setting the page content language by users
151 $wgPageLanguageUseDB = true;
152 $wgGroupPermissions['user']['pagelang'] = true;
154 ## Enable the {{USERLANGUAGE}} magic word
155 $wgParserEnableUserLanguage = true;
157 $wgSecretKey = '<%= @secret_key %>';
159 # Site upgrade key. Must be set to a string (default provided) to turn on the
160 # web installer while LocalSettings.php is in place
161 #$wgUpgradeKey = "6ad907e74fc65836";
163 ## Default skin: you can change the default skin. Use the internal symbolic
164 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
165 $wgDefaultSkin = "<%= @mediawiki[:skin] %>";
167 ## For attaching licensing metadata to pages, and displaying an
168 ## appropriate copyright notice / icon. GNU Free Documentation
169 ## License and Creative Commons licenses are supported so far.
170 $wgRightsPage = "Wiki_content_license"; # Set to the title of a wiki page that describes your license/copyright
171 $wgRightsUrl = "https://creativecommons.org/licenses/by-sa/2.0/";
172 $wgRightsText = "Creative Commons Attribution-ShareAlike 2.0 license";
173 $wgRightsIcon = "/cc-wiki.png";
175 # Path to the GNU diff3 utility. Used for conflict resolution.
176 $wgDiff3 = "/usr/bin/diff3";
178 $wgExternalDiffEngine = 'wikidiff2';
180 # Query string length limit for ResourceLoader. You should only set this if
181 # your web server has a query string length limit (then set it to that limit),
182 # or if you have suhosin.get.max_value_length set in php.ini (then set it to
184 $wgResourceLoaderMaxQueryLength = -1;
186 # End of automatically generated settings.
187 # Add more configuration options below.
189 # Only Allow Signed-in users to edit
190 $wgGroupPermissions['*']['edit'] = false;
192 # Allow bureaucrat group access to oversight options
193 $wgGroupPermissions['bureaucrat']['hideuser'] = true;
194 $wgGroupPermissions['bureaucrat']['deletelogentry'] = true;
195 $wgGroupPermissions['bureaucrat']['deleterevision'] = true;
196 $wgGroupPermissions['bureaucrat']['suppressrevision'] = true;
197 $wgGroupPermissions['bureaucrat']['suppressionlog'] = true;
199 # Since 1.32 MW introduced interface-admin group to separate all UI-related rights. This makes sense for bigger sites,
200 # but for OSM it makes more sense to keep group structure simple. Give all interface-admin rights to sysops.
201 # Also remove the interface-admin group to avoid confusion.
202 $wgGroupPermissions['sysop'] = array_merge( $wgGroupPermissions['sysop'], $wgGroupPermissions['interface-admin'] );
203 unset( $wgGroupPermissions['interface-admin'] );
204 unset( $wgRevokePermissions['interface-admin'] );
205 unset( $wgAddGroups['interface-admin'] );
206 unset( $wgRemoveGroups['interface-admin'] );
207 unset( $wgGroupsAddToSelf['interface-admin'] );
208 unset( $wgGroupsRemoveFromSelf['interface-admin'] );
210 # The v1.32+ gadget system also requires two additional rights
211 # See https://www.mediawiki.org/wiki/Extension:Gadgets
212 $wgGroupPermissions['sysop']['gadgets-edit'] = true;
213 $wgGroupPermissions['sysop']['gadgets-definition-edit'] = true;
215 # Create ipblock-exempt group to grant IP block exemption permission
216 $wgGroupPermissions['ipblock-exempt']['ipblock-exempt'] = true;
218 <% if @mediawiki[:private_accounts] -%>
219 # Prevent new user registrations except by existing users
220 $wgGroupPermissions['*']['createaccount'] = false;
221 $wgGroupPermissions['user']['createaccount'] = true;
224 <% if @mediawiki[:private_site] -%>
225 # Disable reading by anonymous users
226 $wgGroupPermissions['*']['read'] = false;
228 # Allow anonymous users to access the login page
229 $wgWhitelistRead = array ("Special:Userlogin");
231 # Prevent new user registrations except by sysops
232 $wgGroupPermissions['*']['createaccount'] = false;
234 # Restrict access to the upload directory
235 $wgUploadPath = "$wgScriptPath/img_auth.php";
238 # Allow Subpages on Main Namespace
239 $wgNamespacesWithSubpages[NS_MAIN] = true;
241 # DNS Blacklists to use
242 $wgEnableDnsBlacklist = true;
243 $wgDnsBlacklistUrls = [
244 'http.dnsbl.sorbs.net.',
245 'dnsbl-1.uceprotect.net.'
248 # Require validated email to edit
249 $wgEmailConfirmToEdit = true;
251 # Extend autoblock period
252 $wgAutoblockExpiry = 7776000; // 90 days
254 # Disable Hit Counter for Performance
255 $wgDisableCounters = TRUE;
256 # Disable IP in Header to avoid cache issue
257 $wgShowIPinHeader = FALSE;
262 # dissolves double redirects automatically
263 $wgFixDoubleRedirects = TRUE;
265 # Allow external images from a few sites
266 $wgAllowExternalImagesFrom = [
267 'http://tile.openstreetmap.org/',
268 'https://tile.openstreetmap.org',
269 'http://josm.openstreetmap.de/'
272 $wgNoFollowDomainExceptions = [
273 'www.openstreetmap.org',
274 'josm.openstreetmap.de',
275 'taginfo.openstreetmap.org',
276 'blog.openstreetmap.org',
277 'forum.openstreetmap.org',
278 'community.openstreetmap.org',
279 'lists.openstreetmap.org',
280 'help.openstreetmap.org',
282 'wiki.osmfoundation.org',
283 'www.openstreetmap.us',
286 'openstreetmap.community',
287 'www.openstreetbrowser.org',
292 # FIXME - move to specific
293 $wgAllowUserJs = TRUE;
294 $wgAllowUserCss = TRUE;
296 # Raise expensive lua (and other function) call limits to match WP
297 # Docs: https://www.mediawiki.org/wiki/Manual:$wgExpensiveParserFunctionLimit
298 # Wikipedia's Config: https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php
299 $wgExpensiveParserFunctionLimit = 500;
302 <% if @mediawiki[:site_notice] -%>
303 $wgSiteNotice = "<%= @mediawiki[:site_notice] %>";
305 <% if @mediawiki[:site_readonly] -%>
306 $wgReadOnly = ( PHP_SAPI === 'cli' ) ? false : "<%= @mediawiki[:site_readonly] %>";
309 <% @mediawiki[:namespaces].each do |name, details| -%>
311 define('NS_<%= name.upcase %>', <%= details[:id] %>);
312 $wgExtraNamespaces[NS_<%= name.upcase %>] = '<%= name %>';
313 $wgNamespacesWithSubpages[NS_<%= name.upcase %>] = TRUE;
314 $wgContentNamespaces[] = NS_<%= name.upcase %>;
315 $wgNamespacesToBeSearchedDefault[NS_<%= name.upcase %>] = TRUE;
316 define('NS_<%= name.upcase %>_TALK', <%= details[:talk_id] %>);
317 $wgExtraNamespaces[NS_<%= name.upcase %>_TALK] = '<%= name %>_talk';
318 $wgNamespacesWithSubpages[NS_<%= name.upcase %>_TALK] = TRUE;
322 <% unless @mediawiki[:force_ui_messages].empty? -%>
323 # defines which links of the sidebar are translatable
324 $wgForceUIMsgAsContentMsg = array( '<%= @mediawiki[:force_ui_messages].join("', '") %>' );
328 <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%>
329 <%= "require_once('#{file}');" %>
332 <% if @mediawiki[:watch_category_membership] -%>
333 # must be after extensions are loaded
334 $wgRCWatchCategoryMembership = true;
337 <% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%>
338 # require user confirmation for certain actions
339 $wgGroupPermissions['user']['move'] = false;
340 $wgGroupPermissions['user']['movefile'] = false;
341 $wgGroupPermissions['user']['move-categorypages'] = false;
342 $wgGroupPermissions['user']['upload'] = false;
343 $wgGroupPermissions['autoconfirmed']['move'] = true;
344 $wgGroupPermissions['autoconfirmed']['movefile'] = true;
345 $wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
346 $wgGroupPermissions['autoconfirmed']['upload'] = true;
347 # Autopromote users to autoconfirmed
348 $wgAutoConfirmAge = 345600; // 4 days
349 $wgAutoConfirmCount = 10;
351 # user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops
352 $wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed'];
353 $wgAddGroups['sysop'][] = 'confirmed';
354 $wgRemoveGroups['sysop'][] = 'confirmed';
357 <% if @mediawiki[:private_accounts] or @mediawiki[:private_site] -%>
358 # disable automatic confirmation of users, grant all "autoconfirmed" rights to all users
359 $wgAutoConfirmAge = 0;
360 $wgAutoConfirmCount = 0;
361 $wgGroupPermissions['user'] = array_merge( $wgGroupPermissions['user'], $wgGroupPermissions['autoconfirmed'] );
363 unset( $wgGroupPermissions['autoconfirmed'] );
364 unset( $wgRevokePermissions['autoconfirmed'] );
365 unset( $wgAddGroups['autoconfirmed'] );
366 unset( $wgRemoveGroups['autoconfirmed'] );
367 unset( $wgGroupsAddToSelf['autoconfirmed'] );
368 unset( $wgGroupsRemoveFromSelf['autoconfirmed'] );
371 # Increase curl timeout to allow parsoid requests to heavy pages like Map Features
372 # Mediawiki 1.38 has fix to allow this to be set by $wgVirtualRestConfig
373 # https://phabricator.wikimedia.org/T285478
374 $wgHTTPTimeout = 240;
376 # Enable night mode for Minerva and Vector skins
377 # https://github.com/openstreetmap/operations/issues/1230
378 $wgMinervaNightMode['base'] = true;
379 $wgVectorNightMode['logged_in'] = true;
380 $wgVectorNightMode['logged_out'] = true;
382 # Set extremely low timeout to avoid PHP-FPM timeouts on slow connections to Wikimedia Commons (rate limiting) or similar
383 $wgHTTPMaxTimeout = 5;
384 $wgHTTPMaxConnectTimeout = 3;
386 # https://github.com/openstreetmap/operations/issues/1357
387 $wgUseRCPatrol = false;
389 # Add read-only mode option for maintenance.
390 $wgReadOnly = ( PHP_SAPI === 'cli' ) ? false : false;
391 # Enable exception on test mode
392 $wgShowExceptionDetails = <%= @mediawiki[:exception_details] ? 'true' : 'false' %>;