]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/templates/default/LocalSettings.php.erb
ee14cdcd3748e7529e83363c406f95929ca9b875
[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
50 $wgEnotifUserTalk      = true; # UPO
51 $wgEnotifWatchlist     = true; # UPO
52 $wgEmailAuthentication = true;
53
54 $wgEnotifUseJobQ       = true;
55
56 ## Database settings
57 $wgDBtype           = "mysql";
58 $wgDBserver         = "<%= @database_params[:host] %>";
59 $wgDBname           = "<%= @database_params[:name] %>";
60 $wgDBuser           = "<%= @database_params[:username] %>";
61 $wgDBpassword       = "<%= @database_params[:password] %>";
62
63 # MySQL specific settings
64 $wgDBprefix         = "";
65
66 # MySQL table options to use during installation or update
67 $wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
68
69 # Experimental charset support for MySQL 5.0.
70 $wgDBmysql5 = false;
71
72 ## Shared memory settings
73 $wgMainCacheType    = CACHE_MEMCACHED;
74 $wgMemCachedServers = array('127.0.0.1:11211');
75 $wgSessionsInObjectCache = TRUE;
76
77 ## To enable image uploads, make sure the 'images' directory
78 ## is writable, then set this to true:
79 $wgEnableUploads  = true;
80 $wgUseImageMagick = true;
81 $wgImageMagickConvertCommand = "/usr/bin/convert";
82
83 $wgGenerateThumbnailOnParse = false;
84 $wgMaxImageArea = 125000000;
85 $wgMaxShellMemory = 5524000;
86 $wgMaxShellFileSize = 819200;
87 $wgMaxShellTime = 360;
88 $wgMaxShellWallClockTime = 360;
89
90 # Allow some more upload extensions
91 $wgFileExtensions[] = 'doc';
92 $wgFileExtensions[] = 'pdf';
93 $wgFileExtensions[] = 'odt';
94 $wgFileExtensions[] = 'odp';
95 $wgFileExtensions[] = 'ods';
96 $wgFileExtensions[] = 'svg';
97 $wgFileExtensions[] = 'osm';
98 <% @mediawiki[:extra_file_extensions].each do |mw_extra_file_extension| -%>
99         $wgFileExtensions[] = '<%= mw_extra_file_extension %>';
100 <% end -%>
101
102 # Add OSM XML file format per http://www.iana.org/assignments/media-types/media-types.xhtml
103 # Shout out to Paul Norman for reserving this.
104 # Helps MimeMagic determine XML-based formats and chooses the correct MimeType
105 # for .osm files.
106 $wgXMLMimeTypes[] = array('osm' => 'application/vnd.openstreetmap.data+xml');
107
108 $wgTrustedMediaFormats[] = 'application/vnd.openstreetmap.data+xml';
109
110 $wgSVGConverters = array( 'rsvg' => '/usr/bin/rsvg-convert -w $width -h $height -o $output $input');
111 $wgSVGConverter = 'rsvg';
112 $wgSVGMaxSize = 2000;
113
114 # InstantCommons allows wiki to use images from https://commons.wikimedia.org
115 <% if @mediawiki[:commons] -%>
116 $wgUseInstantCommons  = true;
117 <% else -%>
118 $wgUseInstantCommons  = false;
119 <% end -%>
120
121 ## If you use ImageMagick (or any other shell command) on a
122 ## Linux server, this will need to be set to the name of an
123 ## available UTF-8 locale
124 $wgShellLocale = "en_US.utf8";
125
126 ## If you want to use image uploads under safe mode,
127 ## create the directories images/archive, images/thumb and
128 ## images/temp, and make them all writable. Then uncomment
129 ## this, if it's not already uncommented:
130 #$wgHashedUploadDirectory = false;
131
132 ## Set $wgCacheDirectory to a writable directory on the web server
133 ## to make your wiki go slightly faster. The directory should not
134 ## be publically accessible from the web.
135 #$wgCacheDirectory = "$IP/cache";
136
137 # Site language code, should be one of the list in ./languages/Names.php
138 $wgLanguageCode = "en";
139
140 ## Enable setting the page content language by users
141 $wgPageLanguageUseDB = true;
142 $wgGroupPermissions['user']['pagelang'] = true;
143
144 $wgSecretKey = '<%= @node[:mediawiki][:sites][@name][:wgSecretKey] %>';
145
146 # Site upgrade key. Must be set to a string (default provided) to turn on the
147 # web installer while LocalSettings.php is in place
148 #$wgUpgradeKey = "6ad907e74fc65836";
149
150 ## Default skin: you can change the default skin. Use the internal symbolic
151 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
152 $wgDefaultSkin = "<%= @mediawiki[:skin] %>";
153
154 ## For attaching licensing metadata to pages, and displaying an
155 ## appropriate copyright notice / icon. GNU Free Documentation
156 ## License and Creative Commons licenses are supported so far.
157 $wgRightsPage = "Wiki_content_license"; # Set to the title of a wiki page that describes your license/copyright
158 $wgRightsUrl  = "https://creativecommons.org/licenses/by-sa/2.0/";
159 $wgRightsText = "Creative Commons Attribution-ShareAlike 2.0 license";
160 $wgRightsIcon = "/cc-wiki.png";
161
162 # Path to the GNU diff3 utility. Used for conflict resolution.
163 $wgDiff3 = "/usr/bin/diff3";
164
165 $wgExternalDiffEngine = 'wikidiff2';
166
167 # Query string length limit for ResourceLoader. You should only set this if
168 # your web server has a query string length limit (then set it to that limit),
169 # or if you have suhosin.get.max_value_length set in php.ini (then set it to
170 # that value)
171 $wgResourceLoaderMaxQueryLength = -1;
172
173 # End of automatically generated settings.
174 # Add more configuration options below.
175
176 # Only Allow Signed-in users to edit
177 $wgGroupPermissions['*']['edit'] = false;
178
179 # Only allow autoconfirmed for a few actions
180 $wgGroupPermissions['user']['move'] = false;
181 $wgGroupPermissions['user']['movefile'] = false;
182 $wgGroupPermissions['user']['move-categorypages'] = false;
183 $wgGroupPermissions['user']['upload'] = false;
184 $wgGroupPermissions['autoconfirmed']['move'] = true;
185 $wgGroupPermissions['autoconfirmed']['movefile'] = true;
186 $wgGroupPermissions['autoconfirmed']['move-categorypages'] = true;
187 $wgGroupPermissions['autoconfirmed']['upload'] = true;
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 <% 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 <% if @mediawiki[:private_site] -%>
202
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 # Since 1.32 MW introduced interface-admin group to separate all UI-related rights. This makes sense for bigger sites,
213 # but for OSM it makes more sense to keep group structure simple.  Give all interface-admin rights to sysops.
214 # Also remove the interface-admin group to avoid confusion.
215 $wgGroupPermissions['sysop'] = array_merge( $wgGroupPermissions['sysop'], $wgGroupPermissions['interface-admin'] );
216 unset( $wgGroupPermissions['interface-admin'] );
217 unset( $wgRevokePermissions['interface-admin'] );
218 unset( $wgAddGroups['interface-admin'] );
219 unset( $wgRemoveGroups['interface-admin'] );
220 unset( $wgGroupsAddToSelf['interface-admin'] );
221 unset( $wgGroupsRemoveFromSelf['interface-admin'] );
222
223 # Restrict access to the upload directory
224 $wgUploadPath = "$wgScriptPath/img_auth.php";
225 <% end -%>
226
227 # Allow Subpages on Main Namespace
228 $wgNamespacesWithSubpages[NS_MAIN] = true;
229
230 # DNS Blacklists to use
231 $wgEnableDnsBlacklist = true;
232 $wgDnsBlacklistUrls = array( 'proxies.dnsbl.sorbs.net.', 'opm.tornevall.org.', 'xbl.spamhaus.org.', 'dnsbl-3.uceprotect.net.' );
233
234 # Require validated email to edit
235 $wgEmailConfirmToEdit = true;
236
237 # Extend autoblock period
238 $wgAutoblockExpiry = 7776000; // 90 days
239
240 # Spam filter regex
241 $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';
242
243 # Autopromote users to autoconfirmed
244 $wgAutoConfirmAge = 345600; // 4 days
245 $wgAutoConfirmCount = 10;
246
247 # Disable Hit Counter for Performance
248 $wgDisableCounters = TRUE;
249 # Disable IP in Header to avoid cache issue
250 $wgShowIPinHeader = FALSE;
251
252 # Job Runs mostly by cron
253 $wgJobRunRate = 0.01;
254
255 # dissolves double redirects automatically
256 $wgFixDoubleRedirects = TRUE;
257
258 # Allow external images from a few sites
259 $wgAllowExternalImagesFrom = array( 'http://tile.openstreetmap.org/', 'https://tile.openstreetmap.org', 'http://josm.openstreetmap.de/', 'http://trac.openstreetmap.org/', 'http://rweait.dev.openstreetmap.org/' );
260
261 $wgNoFollowDomainExceptions = array( 'www.openstreetmap.org', 'josm.openstreetmap.de', 'taginfo.openstreetmap.org', 'blog.openstreetmap.org', 'wiki.osmfoundation.org' );
262
263 # FIXME - move to specific
264 $wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'portal-url', 'mapfeatures-url', 'helppage' );
265
266 # FIXME - move to specific
267 $wgAllowUserJs = TRUE;
268 $wgAllowUserCss = TRUE;
269
270 # FIXME - move to specific
271 # DE
272 define('NS_LANG_DE', 200);
273 $wgExtraNamespaces[NS_LANG_DE] = 'DE';
274 $wgNamespacesWithSubpages[NS_LANG_DE] = TRUE;
275 $wgContentNamespaces[] = NS_LANG_DE;
276 define('NS_LANG_DE_TALK', 201);
277 $wgExtraNamespaces[NS_LANG_DE_TALK] = 'DE_talk';
278 $wgNamespacesWithSubpages[NS_LANG_DE_TALK] = TRUE;
279
280 # FR
281 define('NS_LANG_FR', 202);
282 $wgExtraNamespaces[NS_LANG_FR] = 'FR';
283 $wgNamespacesWithSubpages[NS_LANG_FR] = TRUE;
284 $wgContentNamespaces[] = NS_LANG_FR;
285 define('NS_LANG_FR_TALK', 203);
286 $wgExtraNamespaces[NS_LANG_FR_TALK] = 'FR_talk';
287 $wgNamespacesWithSubpages[NS_LANG_FR_TALK] = TRUE;
288
289 # ES
290 define('NS_LANG_ES', 204);
291 $wgExtraNamespaces[NS_LANG_ES] = 'ES';
292 $wgNamespacesWithSubpages[NS_LANG_ES] = TRUE;
293 $wgContentNamespaces[] = NS_LANG_ES;
294 define('NS_LANG_ES_TALK', 205);
295 $wgExtraNamespaces[NS_LANG_ES_TALK] = 'ES_talk';
296 $wgNamespacesWithSubpages[NS_LANG_ES_TALK] = TRUE;
297
298 # IT
299 define('NS_LANG_IT', 206);
300 $wgExtraNamespaces[NS_LANG_IT] = 'IT';
301 $wgNamespacesWithSubpages[NS_LANG_IT] = TRUE;
302 $wgContentNamespaces[] = NS_LANG_IT;
303 define('NS_LANG_IT_TALK', 207);
304 $wgExtraNamespaces[NS_LANG_IT_TALK] = 'IT_talk';
305 $wgNamespacesWithSubpages[NS_LANG_IT_TALK] = TRUE;
306
307 # NL
308 define('NS_LANG_NL', 208);
309 $wgExtraNamespaces[NS_LANG_NL] = 'NL';
310 $wgNamespacesWithSubpages[NS_LANG_NL] = TRUE;
311 $wgContentNamespaces[] = NS_LANG_NL;
312 define('NS_LANG_NL_TALK', 209);
313 $wgExtraNamespaces[NS_LANG_NL_TALK] = 'NL_talk';
314 $wgNamespacesWithSubpages[NS_LANG_NL_TALK] = TRUE;
315
316 # RU
317 define('NS_LANG_RU', 210);
318 $wgExtraNamespaces[NS_LANG_RU] = 'RU';
319 $wgNamespacesWithSubpages[NS_LANG_RU] = TRUE;
320 $wgContentNamespaces[] = NS_LANG_RU;
321 define('NS_LANG_RU_TALK', 211);
322 $wgExtraNamespaces[NS_LANG_RU_TALK] = 'RU_talk';
323 $wgNamespacesWithSubpages[NS_LANG_RU_TALK] = TRUE;
324
325 # JA
326 define('NS_LANG_JA', 212);
327 $wgExtraNamespaces[NS_LANG_JA] = 'JA';
328 $wgNamespacesWithSubpages[NS_LANG_JA] = TRUE;
329 $wgContentNamespaces[] = NS_LANG_JA;
330 define('NS_LANG_JA_TALK', 213);
331 $wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk';
332 $wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE;
333
334 $wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE;
335 $wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE;
336 $wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE;
337 $wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE;
338 $wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE;
339 $wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE;
340 $wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE;
341
342
343 # Raise expensive lua (and other function) call limits to match WP
344 # Docs:  https://www.mediawiki.org/wiki/Manual:$wgExpensiveParserFunctionLimit
345 # Wikipedia's Config:  https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php
346 $wgExpensiveParserFunctionLimit = 500;
347
348
349 <% if @mediawiki[:site_notice] -%>
350 $wgSiteNotice = "<%= @mediawiki[:site_notice] %>";
351 <% end -%>
352 <% if @mediawiki[:site_readonly] -%>
353 $wgReadOnly = "<%= @mediawiki[:site_readonly] %>";
354 <% end -%>
355
356 <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%>
357 <%= "require_once('#{file}');" %>
358 <% end -%>