Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
253 changes: 3 additions & 250 deletions _sources/canasta/DockerSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,203 +23,6 @@ function isEnvTrue( $name ): bool {
return false;
}

const DOCKER_SKINS = [
'CologneBlue',
'MinervaNeue',
'Modern',
'MonoBook', # bundled
'Refreshed',
'Timeless', # bundled
'Vector', # bundled
'chameleon',
'Pivot',
];

const DOCKER_EXTENSIONS = [
'SemanticMediaWiki', // keep it at the top to be enabled first, because some Semantic extension don't work in other case.
'AJAXPoll',
'AbuseFilter',
'AddMessages',
'AdminLinks',
'AdvancedSearch',
'AntiSpoof',
'ApprovedRevs',
'Arrays',
'Auth_remoteuser',
'BetaFeatures',
'Bootstrap',
'BootstrapComponents',
'BreadCrumbs2',
'Buggy',
'Cargo',
'CategoryTree', # bundled
'ChangeAuthor',
'CharInsert',
'CheckUser',
'CirrusSearch',
'Cite', # bundled
'CiteThisPage', # bundled
'Citoid',
'CodeEditor', # bundled
'CodeMirror',
'Collection',
'CommentStreams',
'CommonsMetadata',
'ConfirmAccount',
'ConfirmEdit', # bundled
'ConfirmEdit/QuestyCaptcha', # bundled
'ConfirmEdit/ReCaptchaNoCaptcha', # bundled
'ContactPage',
'ContributionScores',
'CookieWarning',
'Cloudflare',
'CrawlerProtection',
'DataTransfer',
'DeleteBatch',
'Description2',
'Disambiguator',
'DiscussionTools', # bundled
'DismissableSiteNotice',
'DisplayTitle',
'DynamicPageList3',
'Echo', # bundled
'EditAccount',
'Editcount',
'Elastica',
'EmailAuthorization',
'EmbedVideo',
'EventLogging',
'EventStreamConfig',
'ExternalData',
'FlexDiagrams',
'GTag',
'Gadgets', # bundled
'GlobalNotice',
'GoogleDocTag',
'GoogleLogin',
'HTMLTags',
'HeadScript',
'HeaderFooter',
'HeaderTabs',
'IframePage',
'ImageMap', # bundled
'InputBox', # bundled
'Interwiki', # bundled
'JWTAuth',
'LDAPAuthentication2',
'LDAPAuthorization',
'LDAPProvider',
'LabeledSectionTransclusion',
'Lingo',
'LinkSuggest',
'LinkTarget',
'Linter', # bundled
'LockAuthor',
'Lockdown',
'LoginNotify', # bundled
'LookupUser',
'Loops',
'LuaCache',
'MagicNoCache',
'Maps',
'MassMessage',
'MassMessageEmail',
'MassPasswordReset',
'Math',
'MediaUploader',
'Mermaid',
'MobileDetect',
'MobileFrontend',
'MsUpload',
'MultimediaViewer', # bundled
'MyVariables',
'NCBITaxonomyLookup',
'NewUserMessage',
'Nuke', # bundled
'NumerAlpha',
'OATHAuth', # bundled
'OAuth',
'OpenGraphMeta',
'OpenIDConnect',
'PDFEmbed',
'PageExchange',
// 'PageForms', must be enabled manually after enableSemantics()
'PageImages', # bundled
'PagePort',
'PageSchemas',
'ParserFunctions', # bundled
'PdfHandler', # bundled
'PluggableAuth',
'Poem', # bundled
'Popups',
'PubmedParser',
'RegularTooltips',
'RemoteWiki',
'ReplaceText', # bundled
'RevisionSlider',
'RottenLinks',
'SandboxLink',
'SaveSpinner',
'Scribunto', # bundled
'SecureLinkFixer', # bundled
'SelectCategory',
'SemanticCompoundQueries',
'SemanticDependencyUpdater', // must be enabled after SemanticMediaWiki
'SemanticExtraSpecialProperties',
// 'SemanticMediaWiki', moved the top to be enabled first, because some Semantic extension don't work in other case.
'SemanticResultFormats',
'SemanticScribunto',
'SemanticWatchlist',
'ShowMe',
'SimpleBatchUpload',
'SimpleChanges',
'SimpleMathJax',
'SimpleTooltip',
'SimpleTippy',
'SkinPerNamespace',
'SkinPerPage',
'SmiteSpam',
'SpamBlacklist', # bundled
'SubPageList',
'Survey',
'SyntaxHighlight_GeSHi', # bundled
'Share',
'Tabber',
'TabberNeue',
'Tabs',
'TemplateData', # bundled
'TemplateStyles',
'TemplateWizard',
'TextExtracts', # bundled
'Thanks', # bundled
'TinyMCE',
'TitleBlacklist', # bundled
'TitleIcon',
'TwitterTag',
'UniversalLanguageSelector',
'UploadWizard',
'UrlGetParameters',
'UserFunctions',
'UserMerge',
'UserPageViewTracker',
'VEForAll',
'Validator',
'Variables',
'VariablesLua',
'VisualEditor', # bundled
'VoteNY',
'WatchAnalytics',
'WSOAuth',
'WSSlots',
'WhoIsWatching',
'Widgets',
'WikiEditor', # bundled
'WikiForum',
'WikiSEO',
'WikiCategoryTagCloud',
'YouTube',
];

$DOCKER_MW_VOLUME = getenv( 'MW_VOLUME' );

########################### Core Settings ##########################
Expand Down Expand Up @@ -326,59 +129,11 @@ function isEnvTrue( $name ): bool {
$wgUseImageMagick = isEnvTrue( 'MW_USE_IMAGE_MAGIC' );

####################### Skin Settings #######################
# Default skin: you can change the default skin. Use the internal symbolic
# names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
$wgDefaultSkin = getenv( 'MW_DEFAULT_SKIN' );
$dockerLoadSkins = null;
$dockerLoadSkins = getenv( 'MW_LOAD_SKINS' );
if ( $dockerLoadSkins ) {
$dockerLoadSkins = explode( ',', $dockerLoadSkins );
$dockerLoadSkins = array_intersect( DOCKER_SKINS, $dockerLoadSkins );
if ( $dockerLoadSkins ) {
wfLoadSkins( $dockerLoadSkins );
}
}
if ( !$dockerLoadSkins ) {
wfLoadSkin( 'Vector' );
$wgDefaultSkin = 'Vector';
} else{
if ( !$wgDefaultSkin ) {
$wgDefaultSkin = reset( $dockerLoadSkins );
}
$dockerLoadSkins = array_combine( $dockerLoadSkins, $dockerLoadSkins );
}

if ( isset( $dockerLoadSkins['chameleon'] ) ) {
wfLoadExtension( 'Bootstrap' );
}
# Make sure there is always at least one skin loaded
wfLoadSkin( 'Vector' );
$wgDefaultSkin = 'Vector';

####################### Extension Settings #######################
// The variable will be an array [ 'extensionName' => 'extensionName, ... ]
// made by see array_combine( $dockerLoadExtensions, $dockerLoadExtensions ) below
$dockerLoadExtensions = getenv( 'MW_LOAD_EXTENSIONS' );
if ( $dockerLoadExtensions ) {
$dockerLoadExtensions = explode( ',', $dockerLoadExtensions );
$dockerLoadExtensions = array_intersect( DOCKER_EXTENSIONS, $dockerLoadExtensions );
if ( $dockerLoadExtensions ) {
$dockerLoadExtensions = array_combine( $dockerLoadExtensions, $dockerLoadExtensions );
// Enable SemanticMediaWiki first, because some Semantic extension don't work in other case
if ( isset( $dockerLoadExtensions['SemanticMediaWiki'] ) ) {
wfLoadExtension( 'SemanticMediaWiki' );
}
foreach ( $dockerLoadExtensions as $extension ) {
if ( $extension === 'SemanticMediaWiki' ) {
// Already loaded above ^
continue;
}
if ( file_exists( "$wgExtensionDirectory/$extension/extension.json" ) ) {
wfLoadExtension( $extension );
} else {
require_once "$wgExtensionDirectory/$extension/$extension.php";
}
}
}
}

# SyntaxHighlight_GeSHi
$wgPygmentizePath = '/usr/bin/pygmentize';

Expand All @@ -391,8 +146,6 @@ function isEnvTrue( $name ): bool {
// Scribunto https://www.mediawiki.org/wiki/Extension:Scribunto
$wgScribuntoDefaultEngine = 'luasandbox';
$wgScribuntoEngineConf['luasandbox']['cpuLimit'] = '120';
$wgScribuntoUseGeSHi = boolval( $dockerLoadExtensions['SyntaxHighlight_GeSHi'] ?? false );
$wgScribuntoUseCodeEditor = boolval( $dockerLoadExtensions['CodeEditor'] ?? false );

# Interwiki
$wgGroupPermissions['sysop']['interwiki'] = true;
Expand Down
Loading