Skip to content

Instantly share code, notes, and snippets.

@WebPlatformDocs
Last active August 29, 2015 14:05
Show Gist options
  • Save WebPlatformDocs/9e79a3e6816063103649 to your computer and use it in GitHub Desktop.
Save WebPlatformDocs/9e79a3e6816063103649 to your computer and use it in GitHub Desktop.
MediaWiki 1.24wmf16 config for WebPlatform Docs
<?php
# vi set ai syntax=php
// Managed by Salt Stack, please DO NOT TOUCH, or ALL CHANGES WILL be LOST!
#error_reporting(0);
#
# Redis job servers
#
$wpdRedisJobServers = array();
$wpdRedisJobServers[] = '10.10.10.60'; #TODO nutcracker too?
#
# Redis session servers
#
$wpdRedisSessionServers = array();
$wpdRedisSessionServers[] = '10.10.10.57:6379';# TODO nutcracker too?
##################### database settings #####################
$wgDBname = "wpwiki";
$wgDBservers = array(
array(
'host' => "masterdb",
'dbname' => $wgDBname,
'user' => "foo",
'password' => "bar",
'type' => "mysql",
'flags' => DBO_DEFAULT,
'load' => 0,
),
);
$wgArticlePath = '/wiki/$1';
$wgScriptPath = '/w';
# ... etc.
require_once( "$IP/../../Settings.php" );
<?php
# vi set ai syntax=php
## Common settings
## Managed by Salt Stack, please DO NOT TOUCH, or ALL CHANGES WILL be LOST!
## Unless you make changes in `salt/code/files/docs/Settings.php`
## How Wikimedia does it, take a look at:
## * https://github.com/wikimedia/operations-mediawiki-config/tree/master/wmf-config
## * https://github.com/wikimedia/operations-puppet/tree/production/modules
##
## Reference pages:
## * http://www.mediawiki.org/wiki/Manual:Configuration_settings
#$wgReadOnly = 'Currently backing up data, will be back shortly [http://status.webplatform.org/ our status page]';
## ref: http://www.mediawiki.org/wiki/Manual:$wgCanonicalServer
$wgServer = "//docs.webplatform.org";
$wgCanonicalServer = "https://docs.webplatform.org";
#$wgServer = "//docs.webplatformstaging.org";
#$wgCanonicalServer = "https://docs.webplatformstaging.org";
$wgCacheDirectory = dirname($IP)."/cache";
#$wgUploadDirectory = $IP"/images";
## WebPlatform Docs
require_once("$IP/extensions/WebPlatformDocs/main.php");
## Upcoming improvements
#$wgDBssl = true;
#$wgSecureLogin = true;
#$wgResourceLoaderUseESI = true;
$wgIncludeLegacyJavaScript = false;
$wgResourceLoaderExperimentalAsyncLoading = true;
## This is because we need the our local
## http server to serve content non compressed
## to the Varnish/Fastly frontend so they can
## server ESI. #TODO: ensure ESI works and that
## fastly serves w/ gzip
##
$wgDisableOutputCompression = true;
$wgMaxShellMemory = 1024 * 512;
## See https://github.com/wikimedia/operations-puppet/tree/production/modules/varnish/templates
## https://github.com/wikimedia/operations-puppet/tree/production/templates/varnish
## Frontend cache settings
$wgUseSquid = true;
$wgSquidServers = array( 'api.fastly.com:80' );
$wpdUdp2logDest = 'salt.local.wpdn:8420'; ## SecurityGroup port: UDP 8420 @salt demux.py
## ref: http://www.mediawiki.org/wiki/Manual:$wgDebugLogGroups
$wgDebugLogGroups = array(
'resresourceloader' => "udp://$wpdUdp2logDest/resresourceloader",
'UserThrottle' => "udp://$wpdUdp2logDest/UserThrottle",
'cite' => "udp://$wpdUdp2logDest/cite",
'thumbnail' => "udp://$wpdUdp2logDest/thumbnail",
'testing' => "udp://$wpdUdp2logDest/testing",
'jobqueue' => "udp://$wpdUdp2logDest/jobqueue/web",
'mkdir' => "udp://$wpdUdp2logDest/mkdir",
'slow-parse' => "udp://$wpdUdp2logDest/slow-parse",
'exception' => "udp://$wpdUdp2logDest/exception",
'session' => "udp://$wpdUdp2logDest/session",
'badblock' => "udp://$wpdUdp2logDest/badblock",
'SpamBlacklistHit' => "udp://$wpdUdp2logDest/spam-blacklist",
'SpamRegex' => "udp://$wpdUdp2logDest/spam-regex",
'ValidationStatistic' => "udp://$wpdUdp2logDest/valid",
'OutputBuffer' => "udp://$wpdUdp2logDest/buffer",
'exec' => "udp://$wpdUdp2logDest/exec",
'runJobs' => "udp://$wpdUdp2logDest/runJobs",
'memcached' => "udp://$wpdUdp2logDest/memcached",
'memcached-serious' => "udp://$wpdUdp2logDest/memcached-serious",
'lc-recache' => "udp://$wpdUdp2logDest/lc-recache",
'generated-pp-node-count' => "udp://$wpdUdp2logDest/generated-pp-node-count",
'api' => "udp://$wpdUdp2logDest/api"
);
$wgDBtype = "mysql";
###### Production caching settings #####################
## ref: https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/mc.php
##
## PAGE CACHE
##
## ref: https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/mc.php
##
## TCP port 11311 is Memcached through Nutcracker
##
$wgMainCacheType = 'memcached-pecl';
$wgMemCachedPersistent = true;
$wgMemCachedTimeout = 250000; # default is 100000
$wgObjectCaches['memcached-pecl'] = array(
'class' => 'MemcachedPeclBagOStuff',
'serializer' => 'php',
'persistent' => false,
'servers' => array('127.0.0.1:11211'), /* 11211 is local nutcracker on an app node */
'server_failure_limit' => 1e9,
'retry_timeout' => -1
);
$wgObjectCaches['redis'] = array(
'class' => 'RedisBagOStuff',
'servers' => array('10.10.10.63:6379'),
'persistent' => true,
);
##
## SESSIONS
##
## ref: https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/CommonSettings.php
##
## $wpdRedisSessionServers is defined in salt/code/files/wiki/LocalSettings.php.jinja
##
$wgObjectCaches['sessions'] = array(
'class' => 'RedisBagOStuff',
'servers' => $wpdRedisSessionServers,
);
##
## JOBS
##
## ref: https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/CommonSettings.php
##
## $wpdRedisJobServers is defined in salt/code/files/wiki/LocalSettings.php.jinja
##
$wgJobTypeConf['default'] = array(
'class' => 'JobQueueRedis',
'redisServer' => $wpdRedisJobServers[0],
'redisConfig' => array( 'connectTimeout' => 2, 'compression' => 'gzip' ),
);
$wgJobQueueAggregator = array(
'class' => 'JobQueueAggregatorRedis',
'redisServers' => $wpdRedisJobServers,
'redisConfig' => array( 'connectTimeout' => 2 ),
);
## renoirb 20140404
## http://ryandlane.com/blog/2009/04/21/allowing-docpptxls-uploads-to-mediawiki-and-getting-proper-mime-types-back/
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ppt', 'pdf', 'psd', 'mp3', 'mp4', 'xls', 'xlsx', 'swf', 'doc','docx', 'odt', 'odc', 'odp', 'odg', 'mpp', 'svg', 'svgz', 'ai', 'txt');
###################
## Extensions
## ref: https://wikitech.wikimedia.org/wiki/EventLogging
## http://www.mediawiki.org/wiki/Extension:EventLogging
#require_once("$IP/extensions/EventLogging/EventLogging.php");
#$wgEventLoggingBaseUri = 'http://173.236.254.222:8080/event.gif';
#$wgEventLoggingFile = dirname($IP)."/logs/events.log";
#$wgEventLoggingSchemaApiUri = $wgServer.'/w/api.php';
## Anti bots
## Has a very basic plugin that checks form application/x-www-form-urlencoded.
## TODO: Add more?
require_once("$IP/extensions/AntiBot/AntiBot.php");
require_once("$IP/extensions/Renameuser/Renameuser.php");
## Syntax Highlighting Extension
require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");
$wgSyntaxHighlightDefaultLang = "html5";
require_once("$IP/extensions/Cite/Cite.php");
require_once("$IP/extensions/Vector/Vector.php");
$wgDefaultUserOptions['vector-collapsiblenav'] = 1;
$wgVectorUseSimpleSearch = true;
require_once("$IP/extensions/WikiEditor/WikiEditor.php");
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
#require_once("$IP/extensions/Gadgets/Gadgets.php"); #DISABLED
require_once("$IP/extensions/CategoryTree/CategoryTree.php");
include_once("$IP/extensions/Validator/Validator.php");
include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php");
enableSemantics('webplatform');
## Semantic Forms Extension
include_once("$IP/extensions/SemanticForms/SemanticForms.php");
$sfgRenameEditTabs = true;
## SemanticResultFormats, an extra set of printers for SMW
require_once("$IP/extensions/SemanticResultFormats/SemanticResultFormats.php");
include_once("$IP/extensions/AdminLinks/AdminLinks.php");
#require_once("$IP/extensions/EmailCapture/EmailCapture.php"); #TODO, find
## Captcha Extension
require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
$wgCaptchaTriggers['edit'] = false;
$wgCaptchaTriggers['create'] = false;
$wgCaptchaTriggers['addurl'] = false;
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin'] = false;
#require_once( "$IP/extensions/ConfirmEdit/WpdCaptcha.php"); #TODO, refactor
#$wgCaptchaClass = 'WpdCaptcha';
## Page mass-delete
require_once("$IP/extensions/Nuke/Nuke.php");
## Comments extension
#require_once("$IP/extensions/Comments/Comments.php");
#$wgCommentsEnabledNS = array(NS_MAIN);
#require_once("$IP/extensions/WebPlatformDocs/extensions/SectionComments/SectionComments.php"); #TODO, REFACTOR, see WebPlatformDocs/main.php
#require_once("$IP/extensions/WebPlatformSearchAutocomplete/WebPlatformSearchAutocomplete.php"); #TODO, refactor
## Sub-page list
require_once("$IP/extensions/SubPageList3/SubPageList3.php");
## DismissableSiteNotice
#require_once("$IP/extensions/DismissableSiteNotice/DismissableSiteNotice.php" ); #DISABLED
## Semantic_Internal_Objects
include_once("$IP/extensions/SemanticInternalObjects/SemanticInternalObjects.php");
## Replace_Text
#require_once("$IP/extensions/ReplaceText/ReplaceText.php"); #TODO, Find?
## StringFunctionsEscaped
require_once("$IP/extensions/ParserFunctions/ParserFunctions.php");
$wgPFEnableStringFunctions = true; // Note: this must be after ParserFunctions and before StringFunctionsEscaped
require_once("$IP/extensions/StringFunctionsEscaped/StringFunctionsEscaped.php"); #NEEDSTOBEADDED
## Social Profile extension
#require_once("$IP/extensions/SocialProfile/SocialProfile.php"); #DISABLED, suggested, and not installed
#$wgUserProfileDisplay['friends'] = true;
#$wgUserProfileDisplay['foes'] = false;
## NewSignupPage extension, for agreeing to site terms
require_once("$IP/extensions/NewSignupPage/NewSignupPage.php"); #NEEDSTOBEADDED
$wgRegisterTrack = true;
$wgUserStatsPointValues['referral_complete'] = 10;
$wgAutoAddFriendOnInvite = true;
$wgForceNewSignupPageInitialization = true;
## CLDR extension, for local language names
require_once("$IP/extensions/cldr/cldr.php");
require_once("$IP/extensions/LookupUser/LookupUser.php"); #NEEDSTOBEADDED
$wgGroupPermissions['*']['lookupuser'] = false;
$wgGroupPermissions['sysop']['lookupuser'] = true;
require_once( "$IP/extensions/UserMerge/UserMerge.php" );
$wgGroupPermissions['bureaucrat']['usermerge'] = true;
require_once( "$IP/extensions/AbuseFilter/AbuseFilter.php" );
$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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment