-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathLocalSettings.php
581 lines (418 loc) · 16.7 KB
/
LocalSettings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
<?php
# GlobalSettings for both production server and localhost development.
#
# You still need a LocalSettings.php to make it work. Do NOT save any secrets,
# passwords, and other senstive data here, because it will be public accessable
# on Github.
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
#-------------------------------------------------------------------------------
# Load instance custom settings in wiki_settings.php
#-------------------------------------------------------------------------------
# Include production server configuration if file exists
if ( file_exists( '../wiki_settings.php' ) ) {
require_once '../wiki_settings.php';
$wgIsProduction = true;
}
# Include local development configuration if file exists
elseif ( file_exists( 'wiki_settings.php' ) ) {
require_once 'wiki_settings.php';
$wgIsProduction = false;
} else {
exit('Please create wiki_settings.php file.');
}
#-------------------------------------------------------------------------------
# PHP INI
#-------------------------------------------------------------------------------
# Include path
ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages" );
# If PHP's memory limit is very low, some operations may fail.
ini_set( 'memory_limit', '64M' );
# Maximum allowed size for uploaded files.
ini_set( 'upload_max_filesize', '8M');
# Must be greater than upload_max_filesize
ini_set( 'post_max_size', '8M');
#-------------------------------------------------------------------------------
# CommandLineMode / HTTPMode
#-------------------------------------------------------------------------------
if ( $wgCommandLineMode ) {
if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
die( "This script must be run from the command line\n" );
}
} elseif ( empty( $wgNoOutputBuffer ) ) {
## Compress output if the browser supports it
if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
}
#-------------------------------------------------------------------------------
# Basics
#-------------------------------------------------------------------------------
$wgSitename = "openSUSE Wiki";
$wgMetaNamespace = "OpenSUSE";
# Allow to display title different than actual page title
# e.g. Main Page --> Welcome to openSUSE
$wgAllowDisplayTitle = true;
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgScriptExtension = ".php";
$wgArticlePath = "/$1";
$wgUsePathInfo = true;
$wgStylePath = "$wgScriptPath/skins";
#-------------------------------------------------------------------------------
# Emails & Notifications
#-------------------------------------------------------------------------------
$wgEnableEmail = true;
$wgEnableUserEmail = false;
$wgEmergencyContact = "[email protected]";
$wgPasswordSender = "[email protected]";
## For a detailed description of the following switches see
## http://meta.wikimedia.org/Enotif and http://meta.wikimedia.org/Eauthent
## There are many more options for fine tuning available see
## /includes/DefaultSettings.php
## UPO means: this is also a user preference option
$wgEnotifUserTalk = true; # UPO
$wgEnotifWatchlist = true; # UPO
$wgEmailAuthentication = false;
#-------------------------------------------------------------------------------
# Database
#-------------------------------------------------------------------------------
# If you're on MySQL 3.x, this next line must be FALSE:
$wgDBmysql4 = true;
# Experimental charset support for MySQL 4.1/5.0.
$wgDBmysql5 = true;
#-------------------------------------------------------------------------------
# Caching
#-------------------------------------------------------------------------------
if ( $wgIsProduction ) {
# File Cache
#$wgUseFileCache = true; /* default: false */
#$wgFileCacheDirectory = "/srv/www/htdocs/cache";
$wgShowIPinHeader = false;
# Use MemCache as main cache type
$wgMemCachedServers = [ 0 => '127.0.0.1:11211' ];
$wgMainCacheType = CACHE_MEMCACHED;
# Session Cache
# session cache needs to be persistent, see
# https://www.mediawiki.org/wiki/Topic:T75cloz7981b8i92
$wgSessionCacheType = CACHE_DB;
# Cache Expiration
# Cache older than LocalSettings.php modification time will expire
$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
$wgCacheEpoch = max( $wgCacheEpoch, $configdate );
$wgEnableSidebarCache = true;
# Make the real IPs visible to the wiki instead of the auth proxy
# (AccessManager) IPs. Without this, IP blocking blocks the proxy IP and
# therefore edits from everywhere.
$wgUseSquid = true;
$wgSquidServers = [];
$wgSquidServers[] = '192.168.47.101'; # elsa.infra.o.o
$wgSquidServers[] = '192.168.47.102'; # anna.infra.o.o
} else {
$wgMainCacheType = CACHE_NONE;
$wgCachePages = false;
}
#-------------------------------------------------------------------------------
# Upload
#-------------------------------------------------------------------------------
## To enable image uploads, make sure the 'images' directory
## is writable, then uncomment this:
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = false;
#$wgImageMagickConvertCommand = "/usr/bin/convert";
# InstantCommons allows wiki to use images from http://commons.wikimedia.org
#$wgUseInstantCommons = true;
## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
# $wgHashedUploadDirectory = false;
# Allow upload of files with the following extensions
$wgFileExtensions = [
'doc',
'docx',
'gif',
'jpg',
'jpeg',
'odp',
'ods',
'odt',
'pdf',
'png',
'ppt',
'pptx',
'svg',
'sxc',
'sxw',
'xls',
'xlsx'
];
#-------------------------------------------------------------------------------
# Math
#-------------------------------------------------------------------------------
## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
# $wgUseTeX = true;
$wgMathPath = "$wgUploadPath/math";
$wgMathDirectory = "$wgUploadDirectory/math";
$wgTmpDirectory = "$wgUploadDirectory/temp";
$wgLocalInterwiki = $wgSitename;
#-------------------------------------------------------------------------------
# Copyright/License
#-------------------------------------------------------------------------------
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage = "";
$wgRightsUrl = "https://www.gnu.org/copyleft/fdl.html";
$wgRightsText = "GNU Free Documentation License";
$wgRightsIcon = "$wgScriptPath/resources/assets/licenses/gnu-fdl.png";
# $wgRightsCode = ""; # Not yet used
#-------------------------------------------------------------------------------
# Logo & Icon
#-------------------------------------------------------------------------------
$wgLogo = "https://static.opensuse.org/favicon.svg";
$wgFavicon = "https://static.opensuse.org/favicon.ico";
$wgAppleTouchIcon = "https://static.opensuse.org/favicon-192.png";
#-------------------------------------------------------------------------------
# Misc
#-------------------------------------------------------------------------------
$wgDiff3 = "/usr/bin/diff3";
$wgUseAjax = true; // Enable Ajax
# Enable links to external images
$wgAllowExternalImages = true;
# Add XMPP functionality
$wgUrlProtocols[] = 'xmpp:';
# Add AppStream functionality
$wgUrlProtocols[] = 'appstream:';
# Category watching
# see https://www.mediawiki.org/wiki/Manual:CategoryMembershipChanges
$wgRCWatchCategoryMembership = true;
$wgDefaultUserOptions['hidecategorization'] = 0;
$wgDefaultUserOptions['watchlisthidecategorization'] = 0;
#-------------------------------------------------------------------------------
# Debug
#-------------------------------------------------------------------------------
if (!$wgIsProduction) {
$wgShowExceptionDetails = true;
$wgDebugToolbar=true;
}
#-------------------------------------------------------------------------------
# Permissions
#-------------------------------------------------------------------------------
# Only login user can edit/create pages
$wgGroupPermissions['*' ]['edit'] = false;
# To be removed once the wiki transition is finished
$wgGroupPermissions['user' ]['import'] = true;
$wgGroupPermissions['user' ]['importupload'] = true;
$wgGroupPermissions['user' ]['move'] = true;
$wgGroupPermissions['sysop']['deleterevision'] = true;
# Don't allow account creating in MediaWiki. Only authenticate with SUSE SSO.
$wgGroupPermissions['*' ]['createaccount'] = false;
$wgGroupPermissions['*' ]['autocreateaccount'] = true;
#-------------------------------------------------------------------------------
# Namespaces
#-------------------------------------------------------------------------------
# Project (meta) namespace
$wgMetaNamespace = 'openSUSE';
# Define namespace constants
define( 'NS_SDB', 100 );
define( 'NS_SDB_TALK', 101 );
define( 'NS_PORTAL', 102 );
define( 'NS_PORTAL_TALK', 103 );
define( 'NS_ARCHIVE', 104 );
define( 'NS_ARCHIVE_TALK', 105 );
define( 'NS_HCL', 106 );
define( 'NS_HCL_TALK', 107 );
define( 'NS_BOOK', 110 );
define( 'NS_BOOK_TALK', 111 );
# Define namespaces
$wgExtraNamespaces[NS_SDB] = 'SDB';
$wgExtraNamespaces[NS_SDB_TALK] = 'SDB_Talk';
$wgExtraNamespaces[NS_PORTAL] = 'Portal';
$wgExtraNamespaces[NS_PORTAL_TALK] = 'Portal_Talk';
$wgExtraNamespaces[NS_ARCHIVE] = 'Archive';
$wgExtraNamespaces[NS_ARCHIVE_TALK] = 'Archive_Talk';
$wgExtraNamespaces[NS_HCL] = 'HCL';
$wgExtraNamespaces[NS_HCL_TALK] = 'HCL_Talk';
$wgExtraNamespaces[NS_BOOK] = 'Book';
$wgExtraNamespaces[NS_BOOK_TALK] = 'Book_Talk';
# Enable/Disable subpages
$wgNamespacesWithSubpages[NS_SPECIAL] = false;
$wgNamespacesWithSubpages[NS_MAIN] = true;
$wgNamespacesWithSubpages[NS_TALK] = true;
$wgNamespacesWithSubpages[NS_USER] = true;
$wgNamespacesWithSubpages[NS_USER_TALK] = true;
$wgNamespacesWithSubpages[NS_PROJECT] = true;
$wgNamespacesWithSubpages[NS_PROJECT_TALK] = true;
$wgNamespacesWithSubpages[NS_FILE] = false;
$wgNamespacesWithSubpages[NS_FILE_TALK] = true;
$wgNamespacesWithSubpages[NS_MEDIAWIKI] = false;
$wgNamespacesWithSubpages[NS_MEDIAWIKI_TALK] = true;
$wgNamespacesWithSubpages[NS_TEMPLATE] = true;
$wgNamespacesWithSubpages[NS_TEMPLATE_TALK] = true;
$wgNamespacesWithSubpages[NS_SDB] = true;
$wgNamespacesWithSubpages[NS_SDB_TALK] = true;
$wgNamespacesWithSubpages[NS_PORTAL] = true;
$wgNamespacesWithSubpages[NS_PORTAL_TALK] = true;
$wgNamespacesWithSubpages[NS_ARCHIVE] = true;
$wgNamespacesWithSubpages[NS_ARCHIVE_TALK] = true;
$wgNamespacesWithSubpages[NS_BOOK] = true;
$wgNamespacesWithSubpages[NS_BOOK_TALK] = true;
# Content namespaces will be listed in search result by default
$wgContentNamespaces = [
NS_MAIN,
NS_PROJECT,
NS_HELP,
NS_SDB,
NS_PORTAL,
NS_ARCHIVE,
NS_HCL,
NS_BOOK
];
$wgAllowCategorizedRecentChanges = true;
$wgNamespacesToBeSearchedDefault = [
NS_MAIN => true,
NS_USER => true,
NS_PROJECT => true,
NS_FILE => true,
NS_TEMPLATE => true,
NS_HELP => true,
NS_CATEGORY => true,
NS_SDB => true,
NS_PORTAL => true,
NS_ARCHIVE => true,
NS_HCL => true,
];
#-------------------------------------------------------------------------------
# Skins
#-------------------------------------------------------------------------------
wfLoadSkin( 'bento' );
wfLoadSkin( 'Chameleon' );
$wgDefaultSkin = "Chameleon";
#-------------------------------------------------------------------------------
# Extensions
#-------------------------------------------------------------------------------
##### Leap version variable provider
wfLoadExtension( 'LeapVersion' );
##### Login proxy / Auth_remoteuser
wfLoadExtension( 'Auth_remoteuser' );
$wgAuthRemoteuserUserUrls = [
'logout' => '/cmd/ICSLogout/?url=' . htmlentities($_SERVER['REQUEST_URI'])
];
if (isset($_SERVER['HTTP_X_USERNAME'])) {
# avoid logging 'undefined index' warnings
$wgAuthRemoteuserUserName = [ $_SERVER['HTTP_X_USERNAME'] ];
$wgAuthRemoteuserUserPrefsForced = [ 'email' => $_SERVER['HTTP_X_EMAIL'] ];
} else {
$wgAuthRemoteuserUserName = [ '' ];
$wgAuthRemoteuserUserPrefsForced = [ 'email' => '' ];
}
##### UserMerge
require_once "$IP/extensions/UserMerge/UserMerge.php";
# By default nobody can use this function, enable for bureaucrat?
$wgGroupPermissions['bureaucrat']['usermerge'] = true;
##### WikiEditor
require_once "$IP/extensions/WikiEditor/WikiEditor.php";
# Default user options for WikiEditor. Otherwise it is not enabled by default.
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
$wgDefaultUserOptions['wikieditor-preview'] = 1;
##### Intersection
require_once "$IP/extensions/intersection/intersection.php";
##### RSS
require_once "$IP/extensions/RSS/RSS.php";
$wgRSSUrlWhitelist = [ '*' ];
##### InputBox
require_once "$IP/extensions/InputBox/InputBox.php";
##### ParserFunctions
require_once "$IP/extensions/ParserFunctions/ParserFunctions.php";
##### CategoryTree.php
require_once "$IP/extensions/CategoryTree/CategoryTree.php";
$wgCategoryTreeMaxDepth = [
CT_MODE_PAGES => 2,
CT_MODE_ALL => 2,
CT_MODE_CATEGORIES => 3,
];
##### EventCountdown
require_once("$IP/extensions/EventCountdown.php");
##### Semantic Maps
if ($wgIsProduction) {
require_once("$IP/extensions/maps-vendor/autoload.php");
$GLOBALS['egMapsGMaps3ApiKey'] = $google_maps_key;
#$GLOBALS['egMapsDefaultService'] = 'openlayers';
#$GLOBALS['egMapsDefaultService'] = 'leaflet';
}
##### MultiBoilerplate
require_once "$IP/extensions/MultiBoilerplate/MultiBoilerplate.php";
$wgMultiBoilerplateOptions = false;
$wgMultiBoilerplatePerNamespace = true;
##### Replace Text
require_once "$IP/extensions/ReplaceText/ReplaceText.php";
##### Interwiki
require_once "$IP/extensions/Interwiki/Interwiki.php";
$wgInterwikiMagic = true;
$wgHideInterlanguageLinks = false;
$wgGroupPermissions['*' ]['interwiki'] = false;
$wgGroupPermissions['sysop']['interwiki'] = true;
##### videoflash
require_once "$IP/extensions/videoflash.php";
##### SyntaxHighligh
require_once "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php";
##### Hide page title
require_once "$IP/extensions/notitle.php";
##### UserPageEditProtection
require_once "$IP/extensions/UserPageEditProtection/UserPageEditProtection.php";
# Only users themselves can edit their own user pages
$wgOnlyUserEditUserPage = true;
# Sysops can edit all user pages
$wgGroupPermissions['sysop']['editalluserpages'] = true;
##### Google Coop
require_once "$IP/extensions/google-coop.php";
##### Nuke - mass deletion
require_once "$IP/extensions/Nuke/Nuke.php";
##### AbuseFilter - spam filter
require_once "$IP/extensions/AbuseFilter/AbuseFilter.php";
# set higher EmergencyDisable limits to prevent spam filter from getting disabled with
# "Warning: This filter was automatically disabled as a safety measure. It reached the limit of matching more than 5.00% of actions."
$wgAbuseFilterEmergencyDisableThreshold['default'] = 0.50; # default 0.05
$wgAbuseFilterEmergencyDisableCount['default'] = 50; # default 2
## Group permission
$wgGroupPermissions['sysop']['abusefilter-modify'] = true;
$wgGroupPermissions['*']['abusefilter-log-detail'] = true;
$wgGroupPermissions['*']['abusefilter-view'] = true;
$wgGroupPermissions['*']['abusefilter-log'] = true;
$wgGroupPermissions['sysop']['abusefilter-private'] = true;
$wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true;
$wgGroupPermissions['sysop']['abusefilter-revert'] = true;
##### Hit counter
require_once "$IP/extensions/HitCounters/HitCounters.php";
##### GitHub: include READMEs etc. from GitHub
require_once "$IP/extensions/GitHub/GitHub.php";
##### Elastica search
if ($wgIsProduction) {
require_once "$IP/extensions/Elastica/Elastica.php";
require_once "$IP/extensions/CirrusSearch/CirrusSearch.php";
$wgCirrusSearchServers = [ $elasticsearch_server ];
$wgSearchType = 'CirrusSearch';
$wgCirrusSearchNamespaceWeights = [
NS_MAIN => 1,
NS_USER => 0.05, # default
NS_PROJECT => 0.6,
NS_MEDIAWIKI => 0.05, # default
NS_FILE => 0.02,
NS_TEMPLATE => 0.005, # default
NS_HELP => 0.1, # default
NS_CATEGORY => 0.02,
NS_SDB => 0.6,
NS_PORTAL => 1,
NS_ARCHIVE => 0.2,
NS_HCL => 0.2,
];
}