mediawiki/conf/LocalSettings.php
paul 5cfd3c1641 chore: update to mediawiki 1.37
- Bump dependencies
- Remove deprecated dependencies
- Use Semantic Media Wiki 4
- Add helper scripts for local testing
- Add S3 capabilities
- Add RemoteUser capabilities

This makes it almost possible to use this image stateless.
SMW adds a config file on installation, this is tracked in Issue #2

Co-authored-by: Paul <paul@zom.bi>
Reviewed-on: #1
2022-03-19 12:49:52 +01:00

263 lines
8.8 KiB
PHP

<?php
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename = getenv("WG_SITENAME");
$wgMetaNamespace = "Meta";
$wgScriptPath = getenv("WG_SCRIPT_PATH");
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
$wgServer = getenv("WG_SERVER");
$wgUploadPath = getenv("WG_UPLOAD_PATH");
# Article path
$wgArticlePath = "/wiki/$1";
$wgUploadDirectory = "/var/www/localstore/images";
## UPO means: this is also a user preference option
$wgEnableEmail = !!getenv("WG_ENABLE_EMAIL");
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = getenv("WG_EMERGENCY_CONTACT");
$wgPasswordSender = getenv("WG_PASSWORD_SENDER");
$wgEnotifUserTalk = !!getenv("WG_ENABLE_EMAIL"); # UPO
$wgEnotifWatchlist = !!getenv("WG_ENABLE_EMAIL"); # UPO
$wgEmailAuthentication = true;
## Database settings
$wgDBtype = getenv("WG_DB_TYPE");
$wgDBserver = getenv("WG_DB_SERVER");
$wgDBname = getenv("WG_DB_NAME");
$wgDBuser = getenv("WG_DB_USER");
$wgDBpassword = getenv("WG_DB_PASSWORD");
$wgDBport = getenv("WG_DB_PORT");
# Postgres specific settings
if (getenv("WG_DB_MWSCHEMA")) {
$wgDBmwschema = getenv("WG_DB_MWSCHEMA");
}
# SQLite-specific settings
$wgSQLiteDataDir = getenv("WG_DATABASE_DIR");
## Shared memory settings
if(php_sapi_name() == "cli") {
$wgMainCacheType = CACHE_NONE;
} else {
$wgMainCacheType = CACHE_ACCEL;
}
$wgMemCachedServers = [];
$wgEnableUploads = !!getenv("WG_ENABLE_UPLOADS");
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgUseInstantCommons = !!getenv("WG_USE_INSTANT_COMMONS");
# telemetry
$wgPingback = 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 = "C.UTF-8";
# Site language code, should be one of the list in ./languages/data/Names.php
$wgLanguageCode = "en";
# Time zone
$wgLocaltimezone = "UTC";
## 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/data/Names.php
$wgLanguageCode = getenv("WG_LANGUAGE_CODE");
$wgSecretKey = getenv("WG_SECRET_KEY");
# Changing this will log out all existing sessions.
$wgAuthenticationTokenVersion = "1";
# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "f6490612e52548f9";
## 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";
$wgGroupPermissions['*']['createaccount'] = !!getenv("ALLOW_PUBLIC_REGISTRATION");
$wgGroupPermissions['*']['autocreateaccount'] = !!getenv("ALLOW_AUTO_REGISTRATION");
$wgGroupPermissions['*']['edit'] = !!getenv("ALLOW_PUBLIC_EDIT");
$wgGroupPermissions['*']['read'] = !!getenv("ALLOW_PUBLIC_READ");
if (!!getenv("USE_REMOTE_AUTH")) {
# Use remote authentication.
# When using the VisualEditor extension create a specific parsoid user for
# locked down wikis (no anonymous read permission), when Parsoid is running
# on localhost.
$wgAuthRemoteuserUserName = [
$_SERVER[ 'REMOTE_USER' ],
$_SERVER[ 'REDIRECT_REMOTE_USER' ],
$_SERVER[ 'REMOTE_ADDR' ] == '127.0.0.1' ? 'parsoid' : ''
];
$wgAuthRemoteuserUserPrefs = [
'realname' => $_SERVER[ 'AUTHENTICATE_DISPLAYNAME' ],
'language' => 'en',
'disablemail' => 0
];
// Users email address should not be changed inside MediaWiki.
$wgAuthRemoteuserUserPrefsForced = [
'email' => $_SERVER[ 'AUTHENTICATE_MAIL' ]
];
}
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = "vector";
# Enabled skins.
#wfLoadSkin( 'MonoBook' );
#wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtensions('ExtensionName');
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'CategoryTree' );
wfLoadExtension( 'Cite' );
wfLoadExtension( 'CiteThisPage' );
wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'Graph' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'InputBox' );
#wfLoadExtension( 'OATHAuth' );
wfLoadExtension( 'Interwiki' );
wfLoadExtension( 'JsonConfig' ); # Configuration via Special Wiki Pages containing JSON
wfLoadExtension( 'LocalisationUpdate' );
wfLoadExtension( 'Maps' ); # OSM Maps
wfLoadExtension( 'Mermaid' ); # Diagrams and flowcharts
wfLoadExtension( 'MsUpload' ); # Better upload formulars
wfLoadExtension( 'MultimediaViewer' );
wfLoadExtension( 'Nuke' ); # Mass delete pages
wfLoadExtension( 'PageImages' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'Poem' ); # Formatting of poems
wfLoadExtension( 'Renameuser' );
wfLoadExtension( 'ReplaceText' );
wfLoadExtension( 'Scribunto' ); # Lua Scripting
wfLoadExtension( 'SecureLinkFixer' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'SubPageList3' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
wfLoadExtension( 'TemplateData' ); # Template schema information
wfLoadExtension( 'TemplateStyles' ); # Embedd Styles from Wiki Pages containing CSS
wfLoadExtension( 'TextExtracts' );
wfLoadExtension( 'TitleBlacklist' );
require_once "$IP/extensions/Validator/Validator.php";
wfLoadExtension( 'VisualEditor' ); # WYSIWYG editor
wfLoadExtension( 'WikiEditor' );
# scribunto configuration
$wgScribuntoDefaultEngine = 'luastandalone';
# Load SMW Extensions
wfLoadExtension( 'PageForms' ); # SMW Dependency
wfLoadExtension( 'SemanticCompoundQueries' ); # Allow combined queries in SMW
wfLoadExtension( 'SemanticExtraSpecialProperties' );
wfLoadExtension( 'SemanticResultFormats' );
wfLoadExtension( 'SemanticScribunto' ); # Lua scripting using semantic information
# Turn on SemanticMediaWiki
$smwgUpgradeKey = 'smw:2020-04-18';
wfLoadExtension( 'SemanticMediaWiki' );
enableSemantics( getenv("SEMANTIC_URL") );
# Configure S3 Storage
if (getenv("S3_SECRET")) {
wfLoadExtension( 'AWS' );
$wgAWSCredentials = [
'key' => getenv("S3_KEY"),
'secret' => getenv("S3_SECRET"),
'token' => false
];
$wgAWSRegion = getenv("S3_REGION");
$wgAWSBucketName = getenv("S3_BUCKET_NAME");
# If you are using minio, you need to set a public policy like this:
# mc policy set public instance/bucket/
# mc admin config set instance/bucket/ api cors_allow_origin=https://wiki.example.com
$wgAWSBucketTopSubdirectory = getenv("S3_SUBDIRECTORY");
$wgAWSRepoHashLevels = '2'; # Default 0; But 2 means that S3 objects
# will be named a/ab/Filename.png (same
# as when MediaWiki stores files in local
# directories)
# ---
$wgAWSRepoDeletedHashLevels = '3'; # Default 0; But 3 for naming
# a/ab/abc/Filename.png (same as
# when MediaWiki stores deleted
# files in local directories)
//The url used for the API (PutObject, etc.)
$wgFileBackends['s3']['endpoint'] = getenv("S3_ENDPOINT");
//The url used for showing images. $1 is translated to the bucket name.
$wgAWSBucketDomain = getenv("S3_BUCKET_DOMAIN_NAME");
}
# Set Subpages on
$wgNamespacesWithSubpages[NS_MAIN] = 1;
# Enable long error messages
if (getenv("DEBUG")) {
$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;
$wgShowSQLErrors = true;
}
# Local configuration for MediaWiki
ini_set( 'max_execution_time', 1000 );
ini_set('memory_limit', '-1');
# Move the SMW config directory
$smwgConfigFileDir = '/var/www/localstore/smwconfig';
# Logos
$wgLogos = [ '1x' => "/wiki/Special:Redirect/file/Logo.png" ];
# Footer icons
if (getenv("DISABLE_ICONS")) {
$wgFooterIcons['poweredby']['semanticmediawiki'] = false;
unset( $wgFooterIcons['poweredby'] );
}
# Responsive
$wgVectorResponsive = true;