Skip to content

Instantly share code, notes, and snippets.

@despens
Created September 24, 2020 14:34
Show Gist options
  • Save despens/1fb618747488298f6f83ea9468661fd3 to your computer and use it in GitHub Desktop.
Save despens/1fb618747488298f6f83ea9468661fd3 to your computer and use it in GitHub Desktop.
New LocalSettings.php for Wikibase docker distribution
<?php
### ----------------------------------------------------------------
#### "base" Wikibase LocalSettings.php
## Database settings
$wgDBserver = getenv('DB_SERVER');
$wgDBname = getenv('DB_NAME');
$wgDBuser = getenv('DB_USER');
$wgDBpassword = getenv('DB_PASS');
## Logs
## Save these logs inside the container
$wgDebugLogGroups = array(
'resourceloader' => '/var/log/mediawiki/resourceloader.log',
'exception' => '/var/log/mediawiki/exception.log',
'error' => '/var/log/mediawiki/error.log',
);
## Site Settings
# TODO pass in the rest of this with env vars?
$wgServer = WebRequest::detectServer();
$wgShellLocale = "en_US.utf8";
$wgLanguageCode = getenv('MW_SITE_LANG');
$wgSitename = getenv('MW_SITE_NAME');
$wgMetaNamespace = "Project";
# Configured web paths & short URLs
# This allows use of the /wiki/* path
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/w"; // this should already have been configured this way
$wgArticlePath = "/wiki/$1";
#Set Secret
$wgSecretKey = getenv('MW_WG_SECRET_KEY');
## RC Age
# https://www.mediawiki.org/wiki/Manual:$wgRCMaxAge
# Items in the recentchanges table are periodically purged; entries older than this many seconds will go.
# The query service (by default) loads data from recent changes
# Set this to 1 year to avoid any changes being removed from the RC table over a shorter period of time.
$wgRCMaxAge = 365 * 24 * 3600;
wfLoadSkin( 'Vector' );
## Wikibase
# Load Wikibase repo & client with the example / default settings.
require_once "$IP/extensions/Wikibase/repo/Wikibase.php";
require_once "$IP/extensions/Wikibase/repo/ExampleSettings.php";
require_once "$IP/extensions/Wikibase/client/WikibaseClient.php";
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
### ----------------------------------------------------------------
## "bundle" Wikibase LocalSettings.php additions
# OAuth
wfLoadExtension( 'OAuth' );
$wgGroupPermissions['sysop']['mwoauthproposeconsumer'] = true;
$wgGroupPermissions['sysop']['mwoauthmanageconsumer'] = true;
$wgGroupPermissions['sysop']['mwoauthviewprivate'] = true;
$wgGroupPermissions['sysop']['mwoauthupdateownconsumer'] = true;
# WikibaseImport
require_once "$IP/extensions/WikibaseImport/WikibaseImport.php";
# CirrusSearch
wfLoadExtension( 'Elastica' );
wfLoadExtension( 'CirrusSearch' );
wfLoadExtension( 'WikibaseCirrusSearch' );
$wgCirrusSearchServers = [ getenv('MW_ELASTIC_HOST') ];
$wgSearchType = 'CirrusSearch';
$wgCirrusSearchExtraIndexSettings['index.mapping.total_fields.limit'] = 5000;
$wgWBCSUseCirrus = true;
# UniversalLanguageSelector
wfLoadExtension( 'UniversalLanguageSelector' );
# cldr
wfLoadExtension( 'cldr' );
#EntitySchema
wfLoadExtension( 'EntitySchema' );
### ----------------------------------------------------------------
### Load extra configuration from config folder
$configFiles = glob("LocalSettings.php.d/*.php");
asort($configFiles);
foreach ($configFiles as $filename) {
require_once $filename;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment