Skip to content

Instantly share code, notes, and snippets.

@jamesmontalvo3
Last active June 13, 2017 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmontalvo3/5adf207623454c9eff98e93152b43108 to your computer and use it in GitHub Desktop.
Save jamesmontalvo3/5adf207623454c9eff98e93152b43108 to your computer and use it in GitHub Desktop.
Meza 2-app-server config

Multi-app server loading [[Main Page]]

Request # Request time (microseconds) server request
1 2567734 App2 /demo/index.php/Main_Page
2 430673 App1 /demo/load.php?debug=false&lang=en&modules=ext.collapsiblevector.collapsibleNav%7Cext.headertabs%7Cext.uls.pt%7Cext.visualEditor.targetLoader%7Cjquery.checkboxShiftClick%2CgetAttrs%2ChighlightText%2CmakeCollapsible%2Cmw-jump%2Cplaceholder%2Csuggestions%7Cmediawiki.page.ready%7Cmediawiki.searchSuggest%7Csite&skin=vector&version=43da68dba780
3 2691265 App2 /demo/load.php?debug=false&lang=en&modules=ext.jquery.async%2Cqtip%7Cext.smw%7Cext.smw.tooltip%2Ctooltips%7Cext.smw.tooltip.styles&skin=vector&version=0ab62dfb598f
4 434904 App1 /demo/load.php?debug=false&lang=en&modules=ext.meetingminutes.template%7Cext.uls.init%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.supportCheck%2Ctrack%2Cve%7Cjquery.accessKeyLabel%2CbyteLength%2Cclient%2Ccookie%2CtabIndex%2Cthrottle-debounce%7Cmediawiki.RegExp%2CTitle%2CUri%2Capi%2Ccldr%2Ccookie%2CjqueryMsg%2Clanguage%2Cnotify%2Ctemplate%2Cuser%2Cutil%7Cmediawiki.action.view.postEdit%7Cmediawiki.api.options%2Cuser%7Cmediawiki.language.data%2Cinit%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.startup%7Cmediawiki.template.regexp%7Cskins.vector.js%7Cuser.defaults&skin=vector&version=86de06ac6a0b
5 1774645 App1 /demo/load.php?debug=false&lang=en&modules=ext.smw.style%7Cext.smw.tooltip.styles&only=styles&skin=vector
6 1719325 App2 /demo/load.php?debug=false&lang=en&modules=ext.smw.style&skin=vector&version=82633335a068
7 331366 App2 /demo/load.php?debug=false&lang=en&modules=ext.uls.nojs%7Cext.visualEditor.desktopArticleTarget.noscript%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.sectionAnchor%7Cmediawiki.skinning.interface%7Cskins.vector.styles&only=styles&skin=vector
8 226173 App2 /demo/load.php?debug=false&lang=en&modules=ext.uls.webfonts.fonts%2Crepository%7Cjquery.uls.data%7Cjquery.webfonts&skin=vector&version=189f5dd7411f
9 202367 App2 /demo/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=l0H82yTS
10 365307 App1 /demo/load.php?debug=false&lang=en&modules=jquery.ui.core%2Ctabs%2Cwidget%7Cjquery.ui.core.styles&skin=vector&version=0a18eecdfa51
11 4345226 App1 /demo/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=vector

Solo-app server loading [[Main Page]]

Request # Request time (microseconds) server request
1 1091090 App1 /demo/index.php/Main_Page
2 544211 App1 /demo/load.php?debug=false&lang=en&modules=ext.collapsiblevector.collapsibleNav%7Cext.headertabs%7Cext.uls.pt%7Cext.visualEditor.targetLoader%7Cjquery.checkboxShiftClick%2CgetAttrs%2ChighlightText%2CmakeCollapsible%2Cmw-jump%2Cplaceholder%2Csuggestions%7Cmediawiki.page.ready%7Cmediawiki.searchSuggest%7Csite&skin=vector&version=a59965ed80f0
3 518185 App1 /demo/load.php?debug=false&lang=en&modules=ext.jquery.async%2Cqtip%7Cext.smw%7Cext.smw.tooltip%2Ctooltips%7Cext.smw.tooltip.styles&skin=vector&version=8c1c644ea8c7
4 423359 App1 /demo/load.php?debug=false&lang=en&modules=ext.meetingminutes.template%7Cext.uls.init%2Cinterface%2Cpreferences%2Cwebfonts%7Cext.visualEditor.desktopArticleTarget.init%7Cext.visualEditor.supportCheck%2Ctrack%2Cve%7Cjquery.accessKeyLabel%2CbyteLength%2Cclient%2Ccookie%2CtabIndex%2Cthrottle-debounce%7Cmediawiki.RegExp%2CTitle%2CUri%2Capi%2Ccldr%2Ccookie%2CjqueryMsg%2Clanguage%2Cnotify%2Ctemplate%2Cuser%2Cutil%7Cmediawiki.action.view.postEdit%7Cmediawiki.api.options%2Cuser%7Cmediawiki.language.data%2Cinit%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.startup%7Cmediawiki.template.regexp%7Cskins.vector.js%7Cuser.defaults&skin=vector&version=2845627b22e3
5 387240 App1 /demo/load.php?debug=false&lang=en&modules=ext.smw.style%7Cext.smw.tooltip.styles&only=styles&skin=vector
6 436252 App1 /demo/load.php?debug=false&lang=en&modules=ext.smw.style&skin=vector&version=cbcc13490e57
7 449394 App1 /demo/load.php?debug=false&lang=en&modules=ext.uls.nojs%7Cext.visualEditor.desktopArticleTarget.noscript%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.sectionAnchor%7Cmediawiki.skinning.interface%7Cskins.vector.styles&only=styles&skin=vector
8 231987 App1 /demo/load.php?debug=false&lang=en&modules=ext.uls.webfonts.fonts%2Crepository%7Cjquery.uls.data%7Cjquery.webfonts&skin=vector&version=14fdf94162ff
9 196898 App1 /demo/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=0wUtP%2BJa
10 479168 App1 /demo/load.php?debug=false&lang=en&modules=jquery.ui.core%2Ctabs%2Cwidget%7Cjquery.ui.core.styles&skin=vector&version=cbb57969768e
11 1765554 App1 /demo/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=vector
<?php
// Ansible managed from template /opt/meza/src/roles/mediawiki/templates/Extensions.php.j2 on controller localhost.localdomain by user root
// Generated: 2017-06-09 15:23:34.591451
/**
* SECTION: CORE MEZA COMPOSER EXTENSIONS
*
* Below is configuration for extensions installed by Composer, which are part
* of core meza. Further down the document is a section for Composer-installed
* local extensions config.
**/
#
# Config for Extension:Semantic MediaWiki
#
// Enable Semantic MediaWiki semantics
enableSemantics( $wikiId );
// Semantic MediaWiki Settings
$smwgQMaxSize = 5000;
// allows adding semantic properties to Templates themselves
// (not just on pages via templates).
$smwgNamespacesWithSemanticLinks[NS_TALK] = true;
$smwgNamespacesWithSemanticLinks[NS_TEMPLATE] = true;
#
# Config for Extension:Semantic Result Formats
#
// SemanticResultFormats formats enabled (beyond defaults)
// These are disabled by default because they send data to external
// web services for rendering, which may be considered a data leak
// $srfgFormats[] = 'googlebar';
// $srfgFormats[] = 'googlepie';
// Disabled until the proper dependencies are added (PHPExcel I think)
// $srfgFormats[] = 'excel';
// Enables the "filtered" format. Where do we use this?
$srfgFormats[] = 'filtered';
// Disabled due to some issue on FOD wikis. Confirm, reenable if possible
// $srfgFormats[] = 'exhibit';
/**
* SECTION: CORE MEZA STANDARD EXTENSIONS
*
* Extensions below are part of core Meza. Further down in this file there may
* be additional extensions specified by this particular installation of meza
**/
wfLoadExtension( "ParserFunctions" );
// Also enable StringFunctions, like len, pos, sub, replace, explode
// https://www.mediawiki.org/wiki/Extension:StringFunctions
$wgPFEnableStringFunctions = true;
wfLoadExtension( "ExternalData" );
wfLoadExtension( "LabeledSectionTransclusion" );
wfLoadExtension( "Cite" );
$wgCiteEnablePopups = true;
wfLoadExtension( "ParserFunctionHelper" );
wfLoadExtension( "CharInsert" );
wfLoadExtension( "PageForms" );
wfLoadExtension( "DismissableSiteNotice" );
wfLoadExtension( "WikiEditor" );
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
$wgDefaultUserOptions['wikieditor-publish'] = 1; # displays publish button
$wgDefaultUserOptions['wikieditor-preview'] = 1; # Displays the Preview and Changes tabs
wfLoadExtension( "SyntaxHighlight_GeSHi" );
wfLoadExtension( "InputBox" );
wfLoadExtension( "ReplaceText" );
wfLoadExtension( "Interwiki" );
$wgGroupPermissions['sysop']['interwiki'] = true;
wfLoadExtension( "YouTube" );
wfLoadExtension( "UniversalLanguageSelector" );
wfLoadExtension( "VisualEditor" );
// Parsoid servers are defined based upon Ansible hosts file and thus
// cannot be easily added to base-extensions.yml. As such, VisualEditor config
// is included directly in LocalSettings.php.j2
wfLoadExtension( "Elastica" );
wfLoadExtension( "Thanks" );
$wgThanksConfirmationRequired = false;
wfLoadExtension( "CollapsibleVector" );
require_once "$IP/extensions/SimpleMathJax/SimpleMathJax.php";
wfLoadExtension( "ImageMap" );
require_once "$IP/extensions/StringFunctionsEscaped/StringFunctionsEscaped.php";
require_once "$IP/extensions/WhoIsWatching/WhoIsWatching.php";
$wgPageShowWatchingUsers = true;
require_once "$IP/extensions/SemanticInternalObjects/SemanticInternalObjects.php";
require_once "$IP/extensions/SemanticCompoundQueries/SemanticCompoundQueries.php";
require_once "$IP/extensions/SemanticDrilldown/SemanticDrilldown.php";
require_once "$IP/extensions/Arrays/Arrays.php";
require_once "$IP/extensions/TalkRight/TalkRight.php";
require_once "$IP/extensions/AdminLinks/AdminLinks.php";
$wgGroupPermissions['sysop']['adminlinks'] = true;
require_once "$IP/extensions/BatchUserRights/BatchUserRights.php";
require_once "$IP/extensions/HeaderTabs/HeaderTabs.php";
$wgHeaderTabsEditTabLink = false;
$wgHeaderTabsRenderSingleTab = true;
wfLoadExtension( "CopyWatchers" );
wfLoadExtension( "Wiretap" );
require_once "$IP/extensions/ApprovedRevs/ApprovedRevs.php";
$egApprovedRevsAutomaticApprovals = false;
wfLoadExtension( "ImagesLoaded" );
wfLoadExtension( "MasonryMainPage" );
require_once "$IP/extensions/WatchAnalytics/WatchAnalytics.php";
$egPendingReviewsEmphasizeDays = 10; // makes Pending Reviews shake after X days
require_once "$IP/extensions/Variables/Variables.php";
require_once "$IP/extensions/ContributionScores/ContributionScores.php";
// Exclude Bots from the reporting - Can be omitted.
$wgContribScoreIgnoreBots = true;
// Exclude Blocked Users from the reporting - Can be omitted.
$wgContribScoreIgnoreBlockedUsers = true;
// Use real user names when available - Can be omitted. Only for MediaWiki 1.19 and later.c
$wgContribScoresUseRealName = true;
// Set to true to disable cache for parser function and inclusion of table.
$wgContribScoreDisableCache = false;
// Each array defines a report - 7,50 is "past 7 days" and "LIMIT 50" - Can be omitted.
$wgContribScoreReports = array(
array(7,50),
array(30,50),
array(0,50)
);
require_once "$IP/extensions/PipeEscape/PipeEscape.php";
require_once "$IP/extensions/CirrusSearch/CirrusSearch.php";
// CirrusSearch cluster(s) are defined based upon Ansible hosts file and thus
// cannot be easily added to base-extensions.yml. As such, CirrusSearch config
// is included directly in LocalSettings.php.j2
require_once "$IP/extensions/Echo/Echo.php";
$wgEchoEmailFooterAddress = $wgPasswordSender;
require_once "$IP/extensions/UploadWizard/UploadWizard.php";
// Needed to make UploadWizard work in IE, see bug 39877
// See also: https://www.mediawiki.org/wiki/Manual:$wgApiFrameOptions
$wgApiFrameOptions = 'SAMEORIGIN';
// Use UploadWizard by default in navigation bar
$wgUploadNavigationUrl = "$wgScriptPath/index.php/Special:UploadWizard";
$wgUploadWizardConfig = array(
'debug' => false,
'autoCategory' => 'Uploaded with UploadWizard',
'feedbackPage' => 'Project:UploadWizard/Feedback',
'altUploadForm' => 'Special:Upload',
'fallbackToAltUploadForm' => false,
'enableFormData' => true, # Should FileAPI uploads be used on supported browsers?
'enableMultipleFiles' => true,
'enableMultiFileSelect' => true,
'tutorial' => array('skip' => true),
'fileExtensions' => $wgFileExtensions, //omitting this can cause errors
'licensing' => array(
// alternatively, use "thirdparty". Set in postLocalSettings.php like:
// $wgUploadWizardConfig['licensing']['defaultType'] = 'thirdparty';
'defaultType' => 'ownwork',
'ownWork' => array(
'type' => 'or',
// Use [[Project:General disclaimer]] instead of default [[Template:Generic]]
'template' => 'Project:General disclaimer',
'defaults' => array( 'generic' ),
'licenses' => array( 'generic' )
),
'thirdParty' => array(
'type' => 'or',
'defaults' => array( 'generic' ),
'licenseGroups' => array(
array(
'head' => 'mwe-upwiz-license-generic-head',
'template' => 'Project:General disclaimer', // again, use General disclaimer
'licenses' => array( 'generic' ),
),
)
),
),
);
require_once "$IP/extensions/DataTransfer/DataTransfer.php";
require_once "$IP/extensions/PageImporter/PageImporter.php";
require_once "$IP/extensions/SemanticMeetingMinutes/SemanticMeetingMinutes.php";
require_once "$IP/extensions/HeaderFooter/HeaderFooter.php";
require_once "$IP/extensions/NumerAlpha/NumerAlpha.php";
/**
* SECTION: LOCAL MEZA COMPOSER EXTENSIONS
*
* Below is configuration for extensions installed by Composer, which are part
* of this local meza installation. This section may be blank if no Composer
* extensions are required for this local installation.
**/
/**
* SECTION: LOCAL MEZA STANDARD EXTENSIONS
*
* Extensions configured by this installation of Meza, but not included in
* core meza. These extensions are defined in MezaLocalExtensions.yml in
* /opt/conf-meza/public. This section may be blank if no additional extensions
* are required for this local installation.
**/
<?php
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
/**
* TABLE OF CONTENTS
* * 1) WIKI-SPECIFIC SETUP
* 2) DEBUG
* 3) PATH SETUP
* 4) EMAIL
* 5) DATABASE SETUP
* 6) GENERAL CONFIGURATION
* 7) PERMISSIONS
* 8) EXTENSION SETTINGS
* 9) LOAD OVERRIDES
*
**/
/**
* 1) WIKI-SPECIFIC SETUP
*
* Acquire the intended wiki either from the REQUEST_URI (for web requests) or
* from the WIKI environment variable (for command line scripts)
**/
// same value as bash variable in config.sh
$m_meza = '/opt/meza';
$m_config_core = '/opt/meza/config/core';
$m_htdocs = '/opt/htdocs';
$m_deploy = '/opt/.deploy-meza';
$m_meza_data = '/opt/data-meza';
if( $wgCommandLineMode ) {
$mezaWikiEnvVarName='WIKI';
// get $wikiId from environment variable
$wikiId = getenv( $mezaWikiEnvVarName );
}
else {
// get $wikiId from URI
$uriParts = explode( '/', $_SERVER['REQUEST_URI'] );
$wikiId = strtolower( $uriParts[1] ); // URI has leading slash, so $uriParts[0] is empty string
}
// get all directory names in /wikis, minus the first two: . and ..
$wikis = array_slice( scandir( "$m_htdocs/wikis" ), 2 );
if ( ! in_array( $wikiId, $wikis ) ) {
// handle invalid wiki
die( "No sir, I ain't heard'a no wiki that goes by the name \"$wikiId\"\n" );
}
#
# PRE LOCAL SETTINGS
#
# (1) Load all PHP files in preLocalSettings.d for all wikis
foreach ( glob("$m_deploy/public/preLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
# (2) Load all PHP files in preLocalSettings.d for this wiki
foreach ( glob("$m_deploy/public/wikis/$wikiId/preLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
/**
* 2) DEBUG
*
* Options to enable debug are below. The lowest-impact solution should be
* chosen. Options are listed from least impact to most impact.
* 1) Add to the URI you're requesting `requestDebug=true` to enable debug
* for just that request.
* 2) Set `$mezaCommandLineDebug = true;` for debug on the command line.
* This is the default, which can be overriden in preLocalSettings_allWiki.php.
* 3) Set `$mezaDebug = array( "NDC\Your-ndc", ... );` in a wiki's preLocalSettings.php
* to enable debug for just specific users on a single wiki.
* 4) Set `$mezaDebug = true;` in a wiki's preLocalSettings.php to enable debug for all
* users of a single wiki.
* 5) Set `$mezaForceDebug = true;` to turn on debug for all users and wikis
**/
$mezaCommandLineDebug = True; // don't we always want debug on command line?
$mezaForceDebug = True;
if ( $mezaForceDebug ) {
$debug = true;
}
elseif ( $wgCommandLineMode && $mezaCommandLineDebug ) {
$debug = true;
}
elseif ( $GLOBALS['mezaDebug'] === true ) {
$debug = true;
}
// Check if $mezaDebug is an array, and if so check if the requesting user is
// in the array.
elseif ( ! $wgCommandLineMode
&& is_array( $GLOBALS['mezaDebug'] )
&& in_array( $_SERVER["REMOTE_USER"], $GLOBALS['mezaDebug'] )
) {
$debug = true;
}
elseif ( isset( $_GET['requestDebug'] ) ) {
$debug = true;
}
else {
$debug = false;
}
if ( $debug ) {
// turn error logging on
error_reporting( -1 );
ini_set( 'display_errors', 1 );
ini_set( 'log_errors', 1 );
// Output errors to log file
ini_set( 'error_log', "$m_meza_data/logs/php.log" );
// MediaWiki Debug Tools
$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
}
// production: no error reporting
else {
error_reporting(0);
ini_set("display_errors", 0);
}
/**
* 3) PATH SETUP
*
*
**/
// ref: https://www.mediawiki.org/wiki/Manual:$wgServer
// From section #Autodetection:
// "When $wgServer is not set, the default value is calculated
// automatically. Some web servers end up returning silly defaults or
// internal names which aren't what you want..."
//
// Depending on proxy setup (particularly for Varnish/Squid caching) may need
// to set $wgInternalServer:
// ref: https://www.mediawiki.org/wiki/Manual:$wgInternalServer
$wgServer = 'https://192.168.56.77';
// https://www.mediawiki.org/wiki/Manual:$wgScriptPath
$wgScriptPath = "/$wikiId";
// https://www.mediawiki.org/wiki/Manual:$wgUploadPath
$wgUploadPath = "$wgScriptPath/img_auth.php";
// https://www.mediawiki.org/wiki/Manual:$wgUploadDirectory
$wgUploadDirectory = "/opt/data-meza/uploads-gluster/$wikiId";
// https://www.mediawiki.org/wiki/Manual:$wgLogo
$wgLogo = "/wikis/$wikiId/config/logo.png";
// https://www.mediawiki.org/wiki/Manual:$wgFavicon
$wgFavicon = "/wikis/$wikiId/config/favicon.ico";
// https://www.mediawiki.org/wiki/Manual:$wgMetaNamespace
$wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
// @todo: handle auth type from preLocalSettings.php
// @todo: handle debug from preLocalSettings_allWikis.php
// From MW web install: Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgScriptExtension = ".php";
## The relative URL path to the skins directory
$wgStylePath = "$wgScriptPath/skins";
$wgResourceBasePath = $wgScriptPath;
/**
* 4) EMAIL
*
* Email configuration
**/
if ( isset( $mezaEnableWikiEmail ) && $mezaEnableWikiEmail ) {
$wgEnableEmail = true;
}
else {
$wgEnableEmail = false;
}
## UPO means: this is also a user preference option
$wgEnableUserEmail = $wgEnableEmail; # UPO
$wgEnotifUserTalk = $wgEnableEmail; # UPO
$wgEnotifWatchlist = $wgEnableEmail; # UPO
$wgEmailAuthentication = $wgEnableEmail;
$wgPasswordSender = 'admin@example.com';
$wgEmergencyContact = 'admin@example.com';
/**
* 5) DATABASE SETUP
*
*
**/
$mezaDatabaseServers = array( '192.168.56.70' );
$mezaDatabaseServers[] = '192.168.56.71';
$mezaDatabasePassword = 'vcoaErO6PXQjrRPjvGxI4YTjFYnqVRW%';
$mezaDatabaseUser = 'wiki_app_user';
$mezaThisServer = '192.168.56.70';
// even though using $wgDBservers method below, keep $wgDBname per warning in:
// https://www.mediawiki.org/wiki/Manual:$wgDBservers
$wgDBname = isset( $mezaCustomDBname ) ? $mezaCustomDBname : "wiki_$wikiId";
// first server in list, master, gets a value of 1. If it's the only server, it
// will get 100% of the load. If there is one slave, it will get a value of 10
// and thus will take ~90% of the read-load (master will take ~10%). If there
// are X slaves, master will take 1/(1+10X) of the load. This causes master to
// get very little of the load, but in the case that all the slaves fail master
// still is configured to pick up the entirety of the read-load.
//
// FIXME: Make load configurable.
$databaseReadLoadRatio = 1;
$wgDBservers = array();
foreach( $mezaDatabaseServers as $databaseServer ) {
if ( $databaseServer === $mezaThisServer ) {
$databaseServer = 'localhost';
}
$wgDBservers[] = array(
'host' => $databaseServer,
'dbname' => $wgDBname,
'user' => $mezaDatabaseUser,
'password' => $mezaDatabasePassword,
'type' => "mysql",
'flags' => DBO_DEFAULT,
'load' => $databaseReadLoadRatio,
);
$databaseReadLoadRatio = 10; // every server after the first gets the same loading
}
# MySQL specific settings
$wgDBprefix = "";
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;
/**
* 6) GENERAL CONFIGURATION
*
*
*
**/
// proxy setup
$wgUserSquid = true;
$wgUsePrivateIPs = true;
$wgSquidServersNoPurge = array(
'192.168.56.77', );
// memcached settings
$wgMainCacheType = CACHE_MEMCACHED;
// If parser cache set to CACHE_MEMCACHED, templates used to format SMW query
// results in generic footer don't work. This is a limitation of
// Extension:HeaderFooter which may or may not be able to be worked around.
$wgParserCacheType = CACHE_NONE;
$wgMessageCacheType = CACHE_MEMCACHED;
$wgMemCachedServers = array(
'127.0.0.1:11211','192.168.56.71:11211',);
// memcached is setup and will work for sessions with meza, unless you use
// SimpleSamlPhp. Previous versions of meza had this set to CACHE_NONE, but
// MW 1.27 requires a session cache. Setting this to CACHE_MEMCACHED as it
// is the ultimate goal. A separate branch contains pulling PHP from the
// IUS repository, which should simplify integrating PHP and memcached in a
// way that SimpleSamlPhp likes. So this may be temporarily breaking for
// SAML, but MW 1.27 may be breaking for SAML anyway due to changes in
// AuthPlugin/AuthManager.
$wgSessionCacheType = CACHE_MEMCACHED;
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgMaxUploadSize = 1024*1024*100; // 100 MB
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons = false;
## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "en_US.utf8";
## 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 = true;
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
#$wgCacheDirectory = "$IP/cache";
# Site language code, should be one of the list in ./languages/Names.php
$wgLanguageCode = "en";
# https://www.mediawiki.org/wiki/Manual:$wgSecretKey
$wgSecretKey = "VFnH9ccvQqEs0D91jxMalMmzHGo1mliKk0zlfmA4FdUBjYkQdTa8EpJTsrhVmEvT";
## 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.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";
# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = "vector";
# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'Vector' );
// allows users to remove the page title.
// https://www.mediawiki.org/wiki/Manual:$wgRestrictDisplayTitle
$wgRestrictDisplayTitle = false;
/**
*
* Take from LocalSettingsAdditions
*
**/
// opens external links in new window
$wgExternalLinkTarget = '_blank';
// added this line to allow linking. specifically to Imagery Online.
$wgAllowExternalImages = true;
$wgAllowImageTag = false;
$wgVectorUseSimpleSearch = true;
//$wgDefaultUserOptions['useeditwarning'] = 1;
// disable page edit warning (edit warning affect Semantic Forms)
$wgVectorFeatures['editwarning']['global'] = false;
$wgDefaultUserOptions['rememberpassword'] = 1;
// users watch pages by default (they can override in settings)
$wgDefaultUserOptions['watchdefault'] = 1;
$wgDefaultUserOptions['watchmoves'] = 1;
$wgDefaultUserOptions['watchdeletion'] = 1;
$wgDefaultUserOptions['watchcreations'] = 1;
$wgEnableMWSuggest = true;
// fixes login issue for some users (login issue fixed in MW version 1.18.1 supposedly)
$wgDisableCookieCheck = true;
#Set Default Timezone
$wgLocaltimezone = "America/Chicago";
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgMaxImageArea = 1.25e10; // Images on [[Snorkel]] fail without this
// $wgMemoryLimit = 500000000; //Default is 50M. This is 500M.
// Increase from default setting for large form
// See https://www.mediawiki.org/wiki/Extension_talk:Semantic_Forms/Archive_April_to_June_2012#Error:_Backtrace_limit_exceeded_during_parsing
// If set to 10million, errors are seen when using Edit with form on mission pages like 41S
// ini_set( 'pcre.backtrack_limit', 10000000 ); //10million
ini_set( 'pcre.backtrack_limit', 1000000000 ); //1 billion
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/local/bin/convert';
// Allowed file types
$wgFileExtensions = array(
'aac',
'bmp',
'docx',
'gif',
'jpg',
'jpeg',
'mpp',
'mp3',
'msg',
'odg',
'odp',
'ods',
'odt',
'pdf',
'png',
'pptx',
'ps',
'svg',
'tiff',
'txt',
'xlsx',
'zip'
);
// Tell Universal Language Selector not to try to guess language based upon IP
// address. This (a) isn't likely needed in enterprise use cases and (b) fails
// anyway due to outdated URLs or firewall rules.
$wgULSGeoService = false;
$wgNamespacesWithSubpages[NS_MAIN] = true;
$wgUseRCPatrol = false;
/**
* 7) PERMISSIONS
*
*
*
**/
if ( ! isset( $mezaAuthType ) ) {
$mezaAuthType = 'anon-edit'; // default: wide open!
}
if ( $mezaAuthType === 'anon-edit' ) {
// allow anonymous read
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['user']['read'] = true;
// allow anonymous write
$wgGroupPermissions['*']['edit'] = true;
$wgGroupPermissions['user']['edit'] = true;
}
else if ( $mezaAuthType === 'anon-read' ) {
// allow anonymous read
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['user']['read'] = true;
// do not allow anonymous write (must be registered user)
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = true;
// do allow anonymous to edit talk pages
$wgGroupPermissions['*']['talk'] = true;
}
else if ( $mezaAuthType === 'user-edit' ) {
// no anonymous
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
// users read and write
$wgGroupPermissions['user']['read'] = true;
$wgGroupPermissions['user']['edit'] = true;
}
else if ( $mezaAuthType === 'user-read' ) {
// no anonymous
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
// users read NOT write, but can talk
$wgGroupPermissions['user']['read'] = true;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['user']['talk'] = true;
$wgGroupPermissions['Contributor'] = $wgGroupPermissions['user'];
$wgGroupPermissions['Contributor']['edit'] = true;
}
else if ( $mezaAuthType === 'viewer-read' ) {
// no anonymous or ordinary users
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['read'] = false;
$wgGroupPermissions['user']['edit'] = false;
// create the Viewer group with read permissions
$wgGroupPermissions['Viewer'] = $wgGroupPermissions['user'];
$wgGroupPermissions['Viewer']['read'] = true;
$wgGroupPermissions['Viewer']['talk'] = true;
// also explicitly give sysop read since you otherwise end up with
// a chicken/egg situation prior to giving people Viewer
$wgGroupPermissions['sysop']['read'] = true;
// Create a contributors group that can edit
$wgGroupPermissions['Contributor'] = $wgGroupPermissions['user'];
$wgGroupPermissions['Contributor']['edit'] = true;
}
/**
* 8) EXTENSION SETTINGS
*
* Extensions defined in meza core and meza local yaml files, which are used to * load the extensions via Git or Composer, and which generate the PHP files
* below.
*/
require_once "/opt/.deploy-meza/Extensions.php";
/**
* Extension:CirrusSearch
*
* CirrusSearch cluster(s) are defined based upon Ansible hosts file and thus
* cannot be easily added to base-extensions.yml. As such, CirrusSearch config
* is included directly in LocalSettings.php.j2
*/
$wgSearchType = 'CirrusSearch';
$wgCirrusSearchClusters['default'] = [];
$wgCirrusSearchClusters['default'][] = 'localhost';
$wgCirrusSearchClusters['default'][] = '192.168.56.71';
/**
* Extension:VisualEditor
*
* Parsoid servers are defined based upon Ansible hosts file and thus
* cannot be easily added to MezaCoreExtensions.yml. As such, VisualEditor config
* is included directly in LocalSettings.php.j2
*/
/**
* HTTP_X_FORWARDED_FOR is set by HAProxy when users request pages via
* the load balancer. No users should directly access webservers. Only
* other services (e.g. Parsoid) should directly access webservers. In
* order to allow services to access MediaWiki with full permissions,
* if HTTP_X_FORWARDED_FOR does NOT exist then assume it's not a regular
* user and grant permissions.
*
* Refs:
* https://www.mediawiki.org/wiki/Talk:Parsoid/Archive#Running_Parsoid_on_a_.22private.22_wiki_-_AccessDeniedError
* https://www.mediawiki.org/wiki/Extension:VisualEditor#Linking_with_Parsoid_in_private_wikis
**/
if ( ! isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = true;
}
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = array(
'url' => 'http://192.168.56.77:8001',
//'HTTPProxy' => 'http://192.168.56.77:8001',
// domain here is not really the domain. It needs to be unique to each wiki
// and both domain and prefix must match settings in Parsoid's settings in
// /etc/parsoid/localsettings.js
// ref:
// https://www.mediawiki.org/wiki/Parsoid/Setup#Multiple_wikis_sharing_the_same_parsoid_service
'domain' => $wikiId,
'prefix' => $wikiId
);
// Define which namespaces will use VE
$wgVisualEditorNamespaces = array_merge(
$wgContentNamespaces,
array(
NS_USER,
NS_HELP,
NS_PROJECT
)
);
/**
* 9) LOAD POST LOCAL SETTINGS
*
* Items to override standard config
*
*
**/
# (1) Load all PHP files in postLocalSettings.d for all wikis
foreach ( glob("$m_deploy/public/postLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
# (2) Load all PHP files in postLocalSettings.d for this wiki
foreach ( glob("$m_deploy/public/wikis/$wikiId/postLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
<?php
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
/**
* TABLE OF CONTENTS
* * 1) WIKI-SPECIFIC SETUP
* 2) DEBUG
* 3) PATH SETUP
* 4) EMAIL
* 5) DATABASE SETUP
* 6) GENERAL CONFIGURATION
* 7) PERMISSIONS
* 8) EXTENSION SETTINGS
* 9) LOAD OVERRIDES
*
**/
/**
* 1) WIKI-SPECIFIC SETUP
*
* Acquire the intended wiki either from the REQUEST_URI (for web requests) or
* from the WIKI environment variable (for command line scripts)
**/
// same value as bash variable in config.sh
$m_meza = '/opt/meza';
$m_config_core = '/opt/meza/config/core';
$m_htdocs = '/opt/htdocs';
$m_deploy = '/opt/.deploy-meza';
$m_meza_data = '/opt/data-meza';
if( $wgCommandLineMode ) {
$mezaWikiEnvVarName='WIKI';
// get $wikiId from environment variable
$wikiId = getenv( $mezaWikiEnvVarName );
}
else {
// get $wikiId from URI
$uriParts = explode( '/', $_SERVER['REQUEST_URI'] );
$wikiId = strtolower( $uriParts[1] ); // URI has leading slash, so $uriParts[0] is empty string
}
// get all directory names in /wikis, minus the first two: . and ..
$wikis = array_slice( scandir( "$m_htdocs/wikis" ), 2 );
if ( ! in_array( $wikiId, $wikis ) ) {
// handle invalid wiki
die( "No sir, I ain't heard'a no wiki that goes by the name \"$wikiId\"\n" );
}
#
# PRE LOCAL SETTINGS
#
# (1) Load all PHP files in preLocalSettings.d for all wikis
foreach ( glob("$m_deploy/public/preLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
# (2) Load all PHP files in preLocalSettings.d for this wiki
foreach ( glob("$m_deploy/public/wikis/$wikiId/preLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
/**
* 2) DEBUG
*
* Options to enable debug are below. The lowest-impact solution should be
* chosen. Options are listed from least impact to most impact.
* 1) Add to the URI you're requesting `requestDebug=true` to enable debug
* for just that request.
* 2) Set `$mezaCommandLineDebug = true;` for debug on the command line.
* This is the default, which can be overriden in preLocalSettings_allWiki.php.
* 3) Set `$mezaDebug = array( "NDC\Your-ndc", ... );` in a wiki's preLocalSettings.php
* to enable debug for just specific users on a single wiki.
* 4) Set `$mezaDebug = true;` in a wiki's preLocalSettings.php to enable debug for all
* users of a single wiki.
* 5) Set `$mezaForceDebug = true;` to turn on debug for all users and wikis
**/
$mezaCommandLineDebug = True; // don't we always want debug on command line?
$mezaForceDebug = True;
if ( $mezaForceDebug ) {
$debug = true;
}
elseif ( $wgCommandLineMode && $mezaCommandLineDebug ) {
$debug = true;
}
elseif ( $GLOBALS['mezaDebug'] === true ) {
$debug = true;
}
// Check if $mezaDebug is an array, and if so check if the requesting user is
// in the array.
elseif ( ! $wgCommandLineMode
&& is_array( $GLOBALS['mezaDebug'] )
&& in_array( $_SERVER["REMOTE_USER"], $GLOBALS['mezaDebug'] )
) {
$debug = true;
}
elseif ( isset( $_GET['requestDebug'] ) ) {
$debug = true;
}
else {
$debug = false;
}
if ( $debug ) {
// turn error logging on
error_reporting( -1 );
ini_set( 'display_errors', 1 );
ini_set( 'log_errors', 1 );
// Output errors to log file
ini_set( 'error_log', "$m_meza_data/logs/php.log" );
// MediaWiki Debug Tools
$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
}
// production: no error reporting
else {
error_reporting(0);
ini_set("display_errors", 0);
}
/**
* 3) PATH SETUP
*
*
**/
// ref: https://www.mediawiki.org/wiki/Manual:$wgServer
// From section #Autodetection:
// "When $wgServer is not set, the default value is calculated
// automatically. Some web servers end up returning silly defaults or
// internal names which aren't what you want..."
//
// Depending on proxy setup (particularly for Varnish/Squid caching) may need
// to set $wgInternalServer:
// ref: https://www.mediawiki.org/wiki/Manual:$wgInternalServer
$wgServer = 'https://192.168.56.77';
// https://www.mediawiki.org/wiki/Manual:$wgScriptPath
$wgScriptPath = "/$wikiId";
// https://www.mediawiki.org/wiki/Manual:$wgUploadPath
$wgUploadPath = "$wgScriptPath/img_auth.php";
// https://www.mediawiki.org/wiki/Manual:$wgUploadDirectory
$wgUploadDirectory = "/opt/data-meza/uploads-gluster/$wikiId";
// https://www.mediawiki.org/wiki/Manual:$wgLogo
$wgLogo = "/wikis/$wikiId/config/logo.png";
// https://www.mediawiki.org/wiki/Manual:$wgFavicon
$wgFavicon = "/wikis/$wikiId/config/favicon.ico";
// https://www.mediawiki.org/wiki/Manual:$wgMetaNamespace
$wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
// @todo: handle auth type from preLocalSettings.php
// @todo: handle debug from preLocalSettings_allWikis.php
// From MW web install: Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgScriptExtension = ".php";
## The relative URL path to the skins directory
$wgStylePath = "$wgScriptPath/skins";
$wgResourceBasePath = $wgScriptPath;
/**
* 4) EMAIL
*
* Email configuration
**/
if ( isset( $mezaEnableWikiEmail ) && $mezaEnableWikiEmail ) {
$wgEnableEmail = true;
}
else {
$wgEnableEmail = false;
}
## UPO means: this is also a user preference option
$wgEnableUserEmail = $wgEnableEmail; # UPO
$wgEnotifUserTalk = $wgEnableEmail; # UPO
$wgEnotifWatchlist = $wgEnableEmail; # UPO
$wgEmailAuthentication = $wgEnableEmail;
$wgPasswordSender = 'admin@example.com';
$wgEmergencyContact = 'admin@example.com';
/**
* 5) DATABASE SETUP
*
*
**/
$mezaDatabaseServers = array( '192.168.56.70' );
$mezaDatabaseServers[] = '192.168.56.71';
$mezaDatabasePassword = 'vcoaErO6PXQjrRPjvGxI4YTjFYnqVRW%';
$mezaDatabaseUser = 'wiki_app_user';
$mezaThisServer = '192.168.56.71';
// even though using $wgDBservers method below, keep $wgDBname per warning in:
// https://www.mediawiki.org/wiki/Manual:$wgDBservers
$wgDBname = isset( $mezaCustomDBname ) ? $mezaCustomDBname : "wiki_$wikiId";
// first server in list, master, gets a value of 1. If it's the only server, it
// will get 100% of the load. If there is one slave, it will get a value of 10
// and thus will take ~90% of the read-load (master will take ~10%). If there
// are X slaves, master will take 1/(1+10X) of the load. This causes master to
// get very little of the load, but in the case that all the slaves fail master
// still is configured to pick up the entirety of the read-load.
//
// FIXME: Make load configurable.
$databaseReadLoadRatio = 1;
$wgDBservers = array();
foreach( $mezaDatabaseServers as $databaseServer ) {
if ( $databaseServer === $mezaThisServer ) {
$databaseServer = 'localhost';
}
$wgDBservers[] = array(
'host' => $databaseServer,
'dbname' => $wgDBname,
'user' => $mezaDatabaseUser,
'password' => $mezaDatabasePassword,
'type' => "mysql",
'flags' => DBO_DEFAULT,
'load' => $databaseReadLoadRatio,
);
$databaseReadLoadRatio = 10; // every server after the first gets the same loading
}
# MySQL specific settings
$wgDBprefix = "";
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;
/**
* 6) GENERAL CONFIGURATION
*
*
*
**/
// proxy setup
$wgUserSquid = true;
$wgUsePrivateIPs = true;
$wgSquidServersNoPurge = array(
'192.168.56.77', );
// memcached settings
$wgMainCacheType = CACHE_MEMCACHED;
// If parser cache set to CACHE_MEMCACHED, templates used to format SMW query
// results in generic footer don't work. This is a limitation of
// Extension:HeaderFooter which may or may not be able to be worked around.
$wgParserCacheType = CACHE_NONE;
$wgMessageCacheType = CACHE_MEMCACHED;
$wgMemCachedServers = array(
'192.168.56.70:11211','127.0.0.1:11211',);
// memcached is setup and will work for sessions with meza, unless you use
// SimpleSamlPhp. Previous versions of meza had this set to CACHE_NONE, but
// MW 1.27 requires a session cache. Setting this to CACHE_MEMCACHED as it
// is the ultimate goal. A separate branch contains pulling PHP from the
// IUS repository, which should simplify integrating PHP and memcached in a
// way that SimpleSamlPhp likes. So this may be temporarily breaking for
// SAML, but MW 1.27 may be breaking for SAML anyway due to changes in
// AuthPlugin/AuthManager.
$wgSessionCacheType = CACHE_MEMCACHED;
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgMaxUploadSize = 1024*1024*100; // 100 MB
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons = false;
## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "en_US.utf8";
## 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 = true;
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
#$wgCacheDirectory = "$IP/cache";
# Site language code, should be one of the list in ./languages/Names.php
$wgLanguageCode = "en";
# https://www.mediawiki.org/wiki/Manual:$wgSecretKey
$wgSecretKey = "VFnH9ccvQqEs0D91jxMalMmzHGo1mliKk0zlfmA4FdUBjYkQdTa8EpJTsrhVmEvT";
## 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.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";
# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = "vector";
# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'Vector' );
// allows users to remove the page title.
// https://www.mediawiki.org/wiki/Manual:$wgRestrictDisplayTitle
$wgRestrictDisplayTitle = false;
/**
*
* Take from LocalSettingsAdditions
*
**/
// opens external links in new window
$wgExternalLinkTarget = '_blank';
// added this line to allow linking. specifically to Imagery Online.
$wgAllowExternalImages = true;
$wgAllowImageTag = false;
$wgVectorUseSimpleSearch = true;
//$wgDefaultUserOptions['useeditwarning'] = 1;
// disable page edit warning (edit warning affect Semantic Forms)
$wgVectorFeatures['editwarning']['global'] = false;
$wgDefaultUserOptions['rememberpassword'] = 1;
// users watch pages by default (they can override in settings)
$wgDefaultUserOptions['watchdefault'] = 1;
$wgDefaultUserOptions['watchmoves'] = 1;
$wgDefaultUserOptions['watchdeletion'] = 1;
$wgDefaultUserOptions['watchcreations'] = 1;
$wgEnableMWSuggest = true;
// fixes login issue for some users (login issue fixed in MW version 1.18.1 supposedly)
$wgDisableCookieCheck = true;
#Set Default Timezone
$wgLocaltimezone = "America/Chicago";
$oldtz = getenv("TZ");
putenv("TZ=$wgLocaltimezone");
$wgMaxImageArea = 1.25e10; // Images on [[Snorkel]] fail without this
// $wgMemoryLimit = 500000000; //Default is 50M. This is 500M.
// Increase from default setting for large form
// See https://www.mediawiki.org/wiki/Extension_talk:Semantic_Forms/Archive_April_to_June_2012#Error:_Backtrace_limit_exceeded_during_parsing
// If set to 10million, errors are seen when using Edit with form on mission pages like 41S
// ini_set( 'pcre.backtrack_limit', 10000000 ); //10million
ini_set( 'pcre.backtrack_limit', 1000000000 ); //1 billion
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/local/bin/convert';
// Allowed file types
$wgFileExtensions = array(
'aac',
'bmp',
'docx',
'gif',
'jpg',
'jpeg',
'mpp',
'mp3',
'msg',
'odg',
'odp',
'ods',
'odt',
'pdf',
'png',
'pptx',
'ps',
'svg',
'tiff',
'txt',
'xlsx',
'zip'
);
// Tell Universal Language Selector not to try to guess language based upon IP
// address. This (a) isn't likely needed in enterprise use cases and (b) fails
// anyway due to outdated URLs or firewall rules.
$wgULSGeoService = false;
$wgNamespacesWithSubpages[NS_MAIN] = true;
$wgUseRCPatrol = false;
/**
* 7) PERMISSIONS
*
*
*
**/
if ( ! isset( $mezaAuthType ) ) {
$mezaAuthType = 'anon-edit'; // default: wide open!
}
if ( $mezaAuthType === 'anon-edit' ) {
// allow anonymous read
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['user']['read'] = true;
// allow anonymous write
$wgGroupPermissions['*']['edit'] = true;
$wgGroupPermissions['user']['edit'] = true;
}
else if ( $mezaAuthType === 'anon-read' ) {
// allow anonymous read
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['user']['read'] = true;
// do not allow anonymous write (must be registered user)
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['edit'] = true;
// do allow anonymous to edit talk pages
$wgGroupPermissions['*']['talk'] = true;
}
else if ( $mezaAuthType === 'user-edit' ) {
// no anonymous
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
// users read and write
$wgGroupPermissions['user']['read'] = true;
$wgGroupPermissions['user']['edit'] = true;
}
else if ( $mezaAuthType === 'user-read' ) {
// no anonymous
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
// users read NOT write, but can talk
$wgGroupPermissions['user']['read'] = true;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['user']['talk'] = true;
$wgGroupPermissions['Contributor'] = $wgGroupPermissions['user'];
$wgGroupPermissions['Contributor']['edit'] = true;
}
else if ( $mezaAuthType === 'viewer-read' ) {
// no anonymous or ordinary users
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['user']['read'] = false;
$wgGroupPermissions['user']['edit'] = false;
// create the Viewer group with read permissions
$wgGroupPermissions['Viewer'] = $wgGroupPermissions['user'];
$wgGroupPermissions['Viewer']['read'] = true;
$wgGroupPermissions['Viewer']['talk'] = true;
// also explicitly give sysop read since you otherwise end up with
// a chicken/egg situation prior to giving people Viewer
$wgGroupPermissions['sysop']['read'] = true;
// Create a contributors group that can edit
$wgGroupPermissions['Contributor'] = $wgGroupPermissions['user'];
$wgGroupPermissions['Contributor']['edit'] = true;
}
/**
* 8) EXTENSION SETTINGS
*
* Extensions defined in meza core and meza local yaml files, which are used to * load the extensions via Git or Composer, and which generate the PHP files
* below.
*/
require_once "/opt/.deploy-meza/Extensions.php";
/**
* Extension:CirrusSearch
*
* CirrusSearch cluster(s) are defined based upon Ansible hosts file and thus
* cannot be easily added to base-extensions.yml. As such, CirrusSearch config
* is included directly in LocalSettings.php.j2
*/
$wgSearchType = 'CirrusSearch';
$wgCirrusSearchClusters['default'] = [];
$wgCirrusSearchClusters['default'][] = '192.168.56.70';
$wgCirrusSearchClusters['default'][] = 'localhost';
/**
* Extension:VisualEditor
*
* Parsoid servers are defined based upon Ansible hosts file and thus
* cannot be easily added to MezaCoreExtensions.yml. As such, VisualEditor config
* is included directly in LocalSettings.php.j2
*/
/**
* HTTP_X_FORWARDED_FOR is set by HAProxy when users request pages via
* the load balancer. No users should directly access webservers. Only
* other services (e.g. Parsoid) should directly access webservers. In
* order to allow services to access MediaWiki with full permissions,
* if HTTP_X_FORWARDED_FOR does NOT exist then assume it's not a regular
* user and grant permissions.
*
* Refs:
* https://www.mediawiki.org/wiki/Talk:Parsoid/Archive#Running_Parsoid_on_a_.22private.22_wiki_-_AccessDeniedError
* https://www.mediawiki.org/wiki/Extension:VisualEditor#Linking_with_Parsoid_in_private_wikis
**/
if ( ! isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
$wgGroupPermissions['*']['read'] = true;
$wgGroupPermissions['*']['edit'] = true;
}
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = array(
'url' => 'http://192.168.56.77:8001',
//'HTTPProxy' => 'http://192.168.56.77:8001',
// domain here is not really the domain. It needs to be unique to each wiki
// and both domain and prefix must match settings in Parsoid's settings in
// /etc/parsoid/localsettings.js
// ref:
// https://www.mediawiki.org/wiki/Parsoid/Setup#Multiple_wikis_sharing_the_same_parsoid_service
'domain' => $wikiId,
'prefix' => $wikiId
);
// Define which namespaces will use VE
$wgVisualEditorNamespaces = array_merge(
$wgContentNamespaces,
array(
NS_USER,
NS_HELP,
NS_PROJECT
)
);
/**
* 9) LOAD POST LOCAL SETTINGS
*
* Items to override standard config
*
*
**/
# (1) Load all PHP files in postLocalSettings.d for all wikis
foreach ( glob("$m_deploy/public/postLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
# (2) Load all PHP files in postLocalSettings.d for this wiki
foreach ( glob("$m_deploy/public/wikis/$wikiId/postLocalSettings.d/*.php") as $filename) {
require_once $filename;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment