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 %>';
30 $wgSecureLogin = true;
31 $wgDefaultUserOptions['prefershttps'] = 1;
32 $wgCookieSecure = true;
34 ## The relative URL path to the skins directory
35 $wgStylePath = "$wgScriptPath/skins";
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] %>";
41 ## UPO means: this is also a user preference option
43 $wgEnableEmail = true;
44 $wgEnableUserEmail = true; # UPO
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] %>";
51 $wgEnotifUserTalk = true; # UPO
52 $wgEnotifWatchlist = true; # UPO
53 $wgEmailAuthentication = true;
55 $wgEnotifUseJobQ = true;
58 "host" => "localhost",
61 "verify_peer_name" => false
68 $wgDBserver = "<%= @database_params[:host] %>";
69 $wgDBname = "<%= @database_params[:name] %>";
70 $wgDBuser = "<%= @database_params[:username] %>";
71 $wgDBpassword = "<%= @database_params[:password] %>";
73 # MySQL specific settings
76 # MySQL table options to use during installation or update
77 $wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
79 # Experimental charset support for MySQL 5.0.
82 ## Shared memory settings
83 $wgMainCacheType = CACHE_MEMCACHED;
84 $wgParserCacheType = CACHE_MEMCACHED;
85 $wgMessageCacheType = CACHE_MEMCACHED;
86 $wgSessionCacheType = CACHE_MEMCACHED;
87 $wgMemCachedServers = array('127.0.0.1:11211');
88 $wgSessionsInObjectCache = TRUE;
90 ## To enable image uploads, make sure the 'images' directory
91 ## is writable, then set this to true:
92 $wgEnableUploads = true;
93 $wgUseImageMagick = true;
94 $wgImageMagickConvertCommand = "/usr/bin/convert";
96 $wgGenerateThumbnailOnParse = false;
97 $wgMaxImageArea = 125000000;
98 $wgMaxShellMemory = 5524000;
99 $wgMaxShellFileSize = 819200;
100 $wgMaxShellTime = 360;
101 $wgMaxShellWallClockTime = 360;
103 # Allow some more upload extensions
104 $wgFileExtensions[] = 'pdf';
105 $wgFileExtensions[] = 'odt';
106 $wgFileExtensions[] = 'odp';
107 $wgFileExtensions[] = 'ods';
108 $wgFileExtensions[] = 'svg';
109 $wgFileExtensions[] = 'osm';
110 $wgFileExtensions[] = 'odg';
111 <% @mediawiki[:extra_file_extensions].each do |mw_extra_file_extension| -%>
112 $wgFileExtensions[] = '<%= mw_extra_file_extension %>';
115 # Add OSM XML file format per http://www.iana.org/assignments/media-types/media-types.xhtml
116 # Shout out to Paul Norman for reserving this.
117 # Helps MimeMagic determine XML-based formats and chooses the correct MimeType
119 $wgXMLMimeTypes[] = array('osm' => 'application/vnd.openstreetmap.data+xml');
121 $wgTrustedMediaFormats[] = 'application/vnd.openstreetmap.data+xml';
123 $wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height -o $output $input');
124 $wgSVGConverter = 'rsvg';
125 $wgSVGMaxSize = 2000;
127 ## If you use ImageMagick (or any other shell command) on a
128 ## Linux server, this will need to be set to the name of an
129 ## available UTF-8 locale
130 $wgShellLocale = "en_US.utf8";
132 ## If you want to use image uploads under safe mode,
133 ## create the directories images/archive, images/thumb and
134 ## images/temp, and make them all writable. Then uncomment
135 ## this, if it's not already uncommented:
136 #$wgHashedUploadDirectory = false;
138 ## Set $wgCacheDirectory to a writable directory on the web server
139 ## to make your wiki go slightly faster. The directory should not
140 ## be publically accessible from the web.
141 $wgCacheDirectory = "$IP/cache";
143 # Site language code, should be one of the list in ./languages/Names.php
144 $wgLanguageCode = "en";
146 ## Enable setting the page content language by users
147 $wgPageLanguageUseDB = true;
148 $wgGroupPermissions['user']['pagelang'] = true;
150 $wgSecretKey = '<%= @secret_key %>';
152 # Site upgrade key. Must be set to a string (default provided) to turn on the
153 # web installer while LocalSettings.php is in place
154 #$wgUpgradeKey = "6ad907e74fc65836";
156 ## Default skin: you can change the default skin. Use the internal symbolic
157 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
158 $wgDefaultSkin = "<%= @mediawiki[:skin] %>";
160 ## For attaching licensing metadata to pages, and displaying an
161 ## appropriate copyright notice / icon. GNU Free Documentation
162 ## License and Creative Commons licenses are supported so far.
163 $wgRightsPage = "Wiki_content_license"; # Set to the title of a wiki page that describes your license/copyright
164 $wgRightsUrl = "https://creativecommons.org/licenses/by-sa/2.0/";
165 $wgRightsText = "Creative Commons Attribution-ShareAlike 2.0 license";
166 $wgRightsIcon = "/cc-wiki.png";
168 # Path to the GNU diff3 utility. Used for conflict resolution.
169 $wgDiff3 = "/usr/bin/diff3";
171 $wgExternalDiffEngine = 'wikidiff2';
173 # Query string length limit for ResourceLoader. You should only set this if
174 # your web server has a query string length limit (then set it to that limit),
175 # or if you have suhosin.get.max_value_length set in php.ini (then set it to
177 $wgResourceLoaderMaxQueryLength = -1;
179 # End of automatically generated settings.
180 # Add more configuration options below.
182 # Only Allow Signed-in users to edit
183 $wgGroupPermissions['*']['edit'] = false;
185 # Allow bureaucrat group access to oversight options
186 $wgGroupPermissions['bureaucrat']['hideuser'] = true;
187 $wgGroupPermissions['bureaucrat']['deletelogentry'] = true;
188 $wgGroupPermissions['bureaucrat']['deleterevision'] = true;
189 $wgGroupPermissions['bureaucrat']['suppressrevision'] = true;
190 $wgGroupPermissions['bureaucrat']['suppressionlog'] = true;
192 # Since 1.32 MW introduced interface-admin group to separate all UI-related rights. This makes sense for bigger sites,
193 # but for OSM it makes more sense to keep group structure simple. Give all interface-admin rights to sysops.
194 # Also remove the interface-admin group to avoid confusion.
195 $wgGroupPermissions['sysop'] = array_merge( $wgGroupPermissions['sysop'], $wgGroupPermissions['interface-admin'] );
196 unset( $wgGroupPermissions['interface-admin'] );
197 unset( $wgRevokePermissions['interface-admin'] );
198 unset( $wgAddGroups['interface-admin'] );
199 unset( $wgRemoveGroups['interface-admin'] );
200 unset( $wgGroupsAddToSelf['interface-admin'] );
201 unset( $wgGroupsRemoveFromSelf['interface-admin'] );
203 # The v1.32+ gadget system also requires two additional rights
204 # See https://www.mediawiki.org/wiki/Extension:Gadgets
205 $wgGroupPermissions['sysop']['gadgets-edit'] = true;
206 $wgGroupPermissions['sysop']['gadgets-definition-edit'] = true;
208 # Create ipblock-exempt group to grant IP block exemption permission
209 $wgGroupPermissions['ipblock-exempt']['ipblock-exempt'] = true;
211 <% if @mediawiki[:private_accounts] -%>
212 # Prevent new user registrations except by existing users
213 $wgGroupPermissions['*']['createaccount'] = false;
214 $wgGroupPermissions['user']['createaccount'] = true;
217 <% if @mediawiki[:private_site] -%>
218 # Disable reading by anonymous users
219 $wgGroupPermissions['*']['read'] = false;
221 # Allow anonymous users to access the login page
222 $wgWhitelistRead = array ("Special:Userlogin");
224 # Prevent new user registrations except by sysops
225 $wgGroupPermissions['*']['createaccount'] = false;
227 # Restrict access to the upload directory
228 $wgUploadPath = "$wgScriptPath/img_auth.php";
231 # Allow Subpages on Main Namespace
232 $wgNamespacesWithSubpages[NS_MAIN] = true;
234 # DNS Blacklists to use
235 $wgEnableDnsBlacklist = true;
236 $wgDnsBlacklistUrls = [
237 'http.dnsbl.sorbs.net.',
238 'dnsbl-1.uceprotect.net.'
241 # Require validated email to edit
242 $wgEmailConfirmToEdit = true;
244 # Extend autoblock period
245 $wgAutoblockExpiry = 7776000; // 90 days
247 # Disable Hit Counter for Performance
248 $wgDisableCounters = TRUE;
249 # Disable IP in Header to avoid cache issue
250 $wgShowIPinHeader = FALSE;
255 # dissolves double redirects automatically
256 $wgFixDoubleRedirects = TRUE;
258 # Allow external images from a few sites
259 $wgAllowExternalImagesFrom = [
260 'http://tile.openstreetmap.org/',
261 'https://tile.openstreetmap.org',
262 'http://josm.openstreetmap.de/'
265 $wgNoFollowDomainExceptions = [
266 'www.openstreetmap.org',
267 'josm.openstreetmap.de',
268 'taginfo.openstreetmap.org',
269 'blog.openstreetmap.org',
270 'forum.openstreetmap.org',
271 'community.openstreetmap.org',
272 'lists.openstreetmap.org',
273 'help.openstreetmap.org',
275 'wiki.osmfoundation.org',
276 'www.openstreetmap.us',
279 'openstreetmap.community',
280 'www.openstreetbrowser.org',
285 # FIXME - move to specific
286 $wgAllowUserJs = TRUE;
287 $wgAllowUserCss = TRUE;
289 # Raise expensive lua (and other function) call limits to match WP
290 # Docs: https://www.mediawiki.org/wiki/Manual:$wgExpensiveParserFunctionLimit
291 # Wikipedia's Config: https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php
292 $wgExpensiveParserFunctionLimit = 500;
295 <% if @mediawiki[:site_notice] -%>
296 $wgSiteNotice = "<%= @mediawiki[:site_notice] %>";
298 <% if @mediawiki[:site_readonly] -%>
299 $wgReadOnly = ( PHP_SAPI === 'cli' ) ? false : "<%= @mediawiki[:site_readonly] %>";
302 <% @mediawiki[:namespaces].each do |name, details| -%>
304 define('NS_<%= name.upcase %>', <%= details[:id] %>);
305 $wgExtraNamespaces[NS_<%= name.upcase %>] = '<%= name %>';
306 $wgNamespacesWithSubpages[NS_<%= name.upcase %>] = TRUE;
307 $wgContentNamespaces[] = NS_<%= name.upcase %>;
308 $wgNamespacesToBeSearchedDefault[NS_<%= name.upcase %>] = TRUE;
309 define('NS_<%= name.upcase %>_TALK', <%= details[:talk_id] %>);
310 $wgExtraNamespaces[NS_<%= name.upcase %>_TALK] = '<%= name %>_talk';
311 $wgNamespacesWithSubpages[NS_<%= name.upcase %>_TALK] = TRUE;
315 <% unless @mediawiki[:force_ui_messages].empty? -%>
316 # defines which links of the sidebar are translatable
317 $wgForceUIMsgAsContentMsg = array( '<%= @mediawiki[:force_ui_messages].join("', '") %>' );
321 <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%>
322 <%= "require_once('#{file}');" %>
325 <% if @mediawiki[:watch_category_membership] -%>
326 # must be after extensions are loaded
327 $wgRCWatchCategoryMembership = true;
330 <% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%>
331 # require user confirmation for certain actions
332 $wgGroupPermissions['user']['move'] = false;
333 $wgGroupPermissions['user']['movefile'] = false;
334 $wgGroupPermissions['user']['move-categorypages'] = false;
335 $wgGroupPermissions['user']['upload'] = false;
336 $wgGroupPermissions['autoconfirmed']['move'] = true;
337 $wgGroupPermissions['autoconfirmed']['movefile'] = true;
338 $wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
339 $wgGroupPermissions['autoconfirmed']['upload'] = true;
340 # Autopromote users to autoconfirmed
341 $wgAutoConfirmAge = 345600; // 4 days
342 $wgAutoConfirmCount = 10;
344 # user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops
345 $wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed'];
346 $wgAddGroups['sysop'][] = 'confirmed';
347 $wgRemoveGroups['sysop'][] = 'confirmed';
350 <% if @mediawiki[:private_accounts] or @mediawiki[:private_site] -%>
351 # disable automatic confirmation of users, grant all "autoconfirmed" rights to all users
352 $wgAutoConfirmAge = 0;
353 $wgAutoConfirmCount = 0;
354 $wgGroupPermissions['user'] = array_merge( $wgGroupPermissions['user'], $wgGroupPermissions['autoconfirmed'] );
356 unset( $wgGroupPermissions['autoconfirmed'] );
357 unset( $wgRevokePermissions['autoconfirmed'] );
358 unset( $wgAddGroups['autoconfirmed'] );
359 unset( $wgRemoveGroups['autoconfirmed'] );
360 unset( $wgGroupsAddToSelf['autoconfirmed'] );
361 unset( $wgGroupsRemoveFromSelf['autoconfirmed'] );
364 # Increase curl timeout to allow parsoid requests to heavy pages like Map Features
365 # Mediawiki 1.38 has fix to allow this to be set by $wgVirtualRestConfig
366 # https://phabricator.wikimedia.org/T285478
367 $wgHTTPTimeout = 240;
369 # Enable night mode for Minerva and Vector skins
370 # https://github.com/openstreetmap/operations/issues/1230
371 $wgMinervaNightMode['base'] = true;
372 $wgVectorNightMode['logged_in'] = true;
373 $wgVectorNightMode['logged_out'] = true;
375 # Set extremely low timeout to avoid PHP-FPM timeouts on slow connections to Wikimedia Commons (rate limiting) or similar
376 $wgHTTPMaxTimeout = 5;
377 $wgHTTPMaxConnectTimeout = 3;