mediawiki/conf/LocalSettings.php

263 lines
8.8 KiB
PHP
Raw Normal View History

2021-01-12 08:49:20 +01:00
<?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;
2021-01-12 12:37:43 +01:00
$wgSitename = getenv("WG_SITENAME");
2021-01-12 08:49:20 +01:00
$wgMetaNamespace = "Meta";
$wgScriptPath = getenv("WG_SCRIPT_PATH");
2022-03-19 12:25:27 +01:00
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
2021-01-12 08:49:20 +01:00
$wgServer = getenv("WG_SERVER");
2021-01-18 02:12:13 +01:00
$wgUploadPath = getenv("WG_UPLOAD_PATH");
2021-01-12 08:49:20 +01:00
# Article path
$wgArticlePath = "/wiki/$1";
$wgUploadDirectory = "/var/www/localstore/images";
## UPO means: this is also a user preference option
2022-03-19 12:25:27 +01:00
$wgEnableEmail = !!getenv("WG_ENABLE_EMAIL");
2021-01-12 08:49:20 +01:00
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = getenv("WG_EMERGENCY_CONTACT");
$wgPasswordSender = getenv("WG_PASSWORD_SENDER");
2022-03-19 12:25:27 +01:00
$wgEnotifUserTalk = !!getenv("WG_ENABLE_EMAIL"); # UPO
$wgEnotifWatchlist = !!getenv("WG_ENABLE_EMAIL"); # UPO
2021-01-12 08:49:20 +01:00
$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 = [];
2022-03-19 12:25:27 +01:00
$wgEnableUploads = !!getenv("WG_ENABLE_UPLOADS");
2021-01-12 08:49:20 +01:00
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
2022-03-19 12:25:27 +01:00
$wgUseInstantCommons = !!getenv("WG_USE_INSTANT_COMMONS");
2021-01-12 08:49:20 +01:00
# 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";
2022-03-19 12:25:27 +01:00
# Site language code, should be one of the list in ./languages/data/Names.php
$wgLanguageCode = "en";
# Time zone
$wgLocaltimezone = "UTC";
2021-01-12 08:49:20 +01:00
## 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
2022-03-19 12:25:27 +01:00
$wgUpgradeKey = "f6490612e52548f9";
2021-01-12 08:49:20 +01:00
## 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");
2022-03-19 12:25:27 +01:00
$wgGroupPermissions['*']['autocreateaccount'] = !!getenv("ALLOW_AUTO_REGISTRATION");
2021-01-12 08:49:20 +01:00
$wgGroupPermissions['*']['edit'] = !!getenv("ALLOW_PUBLIC_EDIT");
$wgGroupPermissions['*']['read'] = !!getenv("ALLOW_PUBLIC_READ");
2022-03-19 12:25:27 +01:00
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' ]
];
}
2021-01-12 08:49:20 +01:00
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'vector', 'monobook':
$wgDefaultSkin = "vector";
# Enabled skins.
2022-03-19 12:25:27 +01:00
#wfLoadSkin( 'MonoBook' );
#wfLoadSkin( 'Timeless' );
2021-01-12 08:49:20 +01:00
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' );
2022-03-19 12:25:27 +01:00
wfLoadExtension( 'CiteThisPage' );
2021-01-12 08:49:20 +01:00
wfLoadExtension( 'CodeEditor' );
2022-03-19 12:25:27 +01:00
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'Graph' );
2021-01-12 08:49:20 +01:00
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'InputBox' );
2021-01-12 21:00:30 +01:00
#wfLoadExtension( 'OATHAuth' );
2022-03-19 12:25:27 +01:00
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' );
2021-01-12 08:49:20 +01:00
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'PdfHandler' );
2022-03-19 12:25:27 +01:00
wfLoadExtension( 'Poem' ); # Formatting of poems
wfLoadExtension( 'Renameuser' );
wfLoadExtension( 'ReplaceText' );
wfLoadExtension( 'Scribunto' ); # Lua Scripting
wfLoadExtension( 'SecureLinkFixer' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'SubPageList3' );
2021-01-12 08:49:20 +01:00
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
2022-03-19 12:25:27 +01:00
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
2021-01-12 08:49:20 +01:00
wfLoadExtension( 'WikiEditor' );
# scribunto configuration
$wgScribuntoDefaultEngine = 'luastandalone';
2022-03-19 12:25:27 +01:00
# 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
2021-01-12 08:49:20 +01:00
# Turn on SemanticMediaWiki
2022-03-19 12:25:27 +01:00
$smwgUpgradeKey = 'smw:2020-04-18';
wfLoadExtension( 'SemanticMediaWiki' );
2021-01-12 08:49:20 +01:00
enableSemantics( getenv("SEMANTIC_URL") );
2022-03-19 12:25:27 +01:00
# 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");
}
2021-01-12 08:49:20 +01:00
# 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';
2022-03-19 12:25:27 +01:00
# Logos
$wgLogos = [ '1x' => "/wiki/Special:Redirect/file/Logo.png" ];
2021-01-12 08:49:20 +01:00
# Footer icons
if (getenv("DISABLE_ICONS")) {
2022-03-19 12:25:27 +01:00
$wgFooterIcons['poweredby']['semanticmediawiki'] = false;
2021-01-12 08:49:20 +01:00
unset( $wgFooterIcons['poweredby'] );
}
# Responsive
$wgVectorResponsive = true;