Initial
This commit is contained in:
commit
dbe93cfc58
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/.idea
|
||||
/config.json
|
||||
/data/images
|
||||
!/data/images/.gitkeep
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM mediawiki:latest AS base
|
||||
ENV DEBIAN_FRONTEND="noninteractive"
|
||||
|
||||
COPY ./config.json /tmp/config.json
|
||||
COPY ./build /tmp
|
||||
|
||||
RUN find /tmp/mediawiki_extensions -name "*.tar.gz" -exec sh -c 'tar -xzf {} -C /var/www/html/extensions' \; \
|
||||
&& find /tmp/mediawiki_skins -name "*.tar.gz" -exec sh -c 'tar -xzf {} -C /var/www/html/skins' \; \
|
||||
&& find /tmp/mediawiki_override -type f -exec php /tmp/scripts/config_placeholder_replace.php "/tmp/config.json" "{}" \; \
|
||||
&& mv /tmp/mediawiki_override/* /var/www/html \
|
||||
&& rm -R /tmp/*
|
BIN
build/mediawiki_extensions/FontAwesome.tar.gz
Normal file
BIN
build/mediawiki_extensions/FontAwesome.tar.gz
Normal file
Binary file not shown.
BIN
build/mediawiki_extensions/MobileFrontend.tar.gz
Normal file
BIN
build/mediawiki_extensions/MobileFrontend.tar.gz
Normal file
Binary file not shown.
BIN
build/mediawiki_extensions/MonacoEditor.tar.gz
Normal file
BIN
build/mediawiki_extensions/MonacoEditor.tar.gz
Normal file
Binary file not shown.
BIN
build/mediawiki_extensions/RequireJS.tar.gz
Normal file
BIN
build/mediawiki_extensions/RequireJS.tar.gz
Normal file
Binary file not shown.
BIN
build/mediawiki_extensions/TimedMediaHandler.tar.gz
Normal file
BIN
build/mediawiki_extensions/TimedMediaHandler.tar.gz
Normal file
Binary file not shown.
271
build/mediawiki_override/LocalSettings.php
Normal file
271
build/mediawiki_override/LocalSettings.php
Normal file
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
// Protect against web entry
|
||||
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Settings: database connection
|
||||
$wgDBtype = "mysql";
|
||||
$wgDBserver = "{{MYSQL_HOST}}";
|
||||
$wgDBname = "{{MYSQL_DB}}";
|
||||
$wgDBuser = "{{MYSQL_USER}}";
|
||||
$wgDBpassword = "{{MYSQL_PASSWORD}}";
|
||||
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
|
||||
$wgDBprefix = "";
|
||||
|
||||
// Settings: allow raw html
|
||||
$wgRawHtml = true;
|
||||
|
||||
// Settings: secret
|
||||
$wgSecretKey = "{{SITE_SECRET_KEY}}";
|
||||
$wgAuthenticationTokenVersion = "1"; // Changing this will log out all existing sessions.
|
||||
$wgUpgradeKey = "{{SITE_UPGRADE_KEY}}";
|
||||
|
||||
// Settings: general wiki settings
|
||||
$wgSitename = "{{SITE_NAME}}";
|
||||
$wgMetaNamespace = "Wiki";
|
||||
|
||||
$wgEmergencyContact = '{{SITE_EMERGENCY_CONTACT}}';
|
||||
|
||||
$wgServer = 'https://' . (array_key_exists('HTTP_HOST', $_SERVER) ? $_SERVER['HTTP_HOST'] : '{{SITE_DOMAIN}}');
|
||||
|
||||
// Site language code, should be one of the list in ./languages/data/Names.php
|
||||
$wgLanguageCode = "{{SITE_LANG}}";
|
||||
|
||||
// $wgDisableOutputCompression = true;
|
||||
$wgScriptPath = ""; // the URL base path to the directory containing the wiki, @see https://www.mediawiki.org/wiki/Manual:Short_URL
|
||||
$wgResourceBasePath = $wgScriptPath; // the URL path to static resources (images, scripts, etc.)
|
||||
|
||||
// The URL paths to the logo. Make sure you change this from the default,
|
||||
// or else you'll overwrite your logo when you upgrade!
|
||||
$wgLogos = [
|
||||
'1x' => "$wgResourceBasePath/resources/assets/wiki.png",
|
||||
// '1x' => "$wgScriptPath/extensions/StuzersWiki/assets/images/wiki.png",
|
||||
];
|
||||
//$wgFavicon = "$wgScriptPath/extensions/StuzersWiki/assets/images/favicon.ico";
|
||||
|
||||
// Settings: UPO
|
||||
// UPO means: this is also a user preference option
|
||||
$wgEnableEmail = true;
|
||||
$wgEnableUserEmail = false; # UPO
|
||||
|
||||
$wgPasswordSender = "";
|
||||
|
||||
$wgEnotifUserTalk = false; # UPO
|
||||
$wgEnotifWatchlist = false; # UPO
|
||||
$wgEmailAuthentication = true;
|
||||
|
||||
// Settings: file uploading
|
||||
// To enable image uploads, make sure the 'images' directory
|
||||
// is writable, then set this to true:
|
||||
$wgEnableUploads = true;
|
||||
// $wgUseImageMagick = true;
|
||||
// $wgImageMagickConvertCommand = "/usr/bin/convert";
|
||||
// $wgFileExtensions = [];
|
||||
// $wgMaxUploadSize = 99999;
|
||||
// $wgUploadSizeWarning = 0;
|
||||
// $wgVerifyMimeType = false;
|
||||
$wgUseInstantCommons = false; // InstantCommons allows wiki to use images from https://commons.wikimedia.org
|
||||
|
||||
$wgFileExtensions = array_merge($wgFileExtensions, array('gz'));
|
||||
|
||||
// Periodically send a pingback to https://www.mediawiki.org/ with basic data
|
||||
// about this MediaWiki instance. The Wikimedia Foundation shares this data
|
||||
// with MediaWiki developers to help guide future development efforts.
|
||||
$wgPingback = false;
|
||||
|
||||
// Time zone
|
||||
$wgLocaltimezone = "Europe/Kiev";
|
||||
date_default_timezone_set( $wgLocaltimezone );
|
||||
|
||||
// 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";
|
||||
|
||||
// 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";
|
||||
|
||||
// The following permissions were set based on your choice in the installer
|
||||
$wgGroupPermissions['*']["createaccount"] = false;
|
||||
$wgGroupPermissions['*']["edit"] = false;
|
||||
$wgGroupPermissions['*']["read"] = false;
|
||||
$wgGroupPermissions['user']['oathauth-enable'] = true;
|
||||
|
||||
// Allowed file extensions to upload
|
||||
$wgFileExtensions = array_merge($wgFileExtensions, [
|
||||
"js", "css", "svg"
|
||||
]);
|
||||
//$wgFileBlacklist = array_diff($wgFileBlacklist, [ // @fixme
|
||||
// "js", "svg"
|
||||
//]);
|
||||
|
||||
// $wgMimeTypes = array_merge($wgMimeTypes, [
|
||||
// "text/javascript"
|
||||
// ]);
|
||||
// $wgTrustedMediaFormats = array_merge($wgTrustedMediaFormats, [
|
||||
// // "TEXT",
|
||||
// // "UNKNOWN",
|
||||
// ]);
|
||||
|
||||
// $wgStrictFileExtensions = false; // !!! Setting $wgStrictFileExtensions to false, or altering $wgFileBlacklist could result in either you or your users being exposed to security risks.
|
||||
|
||||
// Enable upload from URL
|
||||
$wgGroupPermissions['user']['upload_by_url'] = true;
|
||||
|
||||
// Settings: set "/wiki" page prefix
|
||||
$wgArticlePath = "/wiki/$1";
|
||||
$wgUsePathInfo = true;
|
||||
|
||||
// Settings: set target="_blank" for external links
|
||||
$wgExternalLinkTarget = '_blank';
|
||||
|
||||
// Settings: enable MediaWiki:Common.js sitewide
|
||||
$wgUseSiteJs = true;
|
||||
|
||||
//$wgImageMagickConvertCommand = "/usr/bin/convert";
|
||||
|
||||
// Settings: skin
|
||||
wfLoadSkin("Vector");
|
||||
$wgDefaultSkin = "vector";
|
||||
wfLoadSkin("MinervaNeue");
|
||||
$wgMFDefaultSkinClass = 'SkinMinerva';
|
||||
|
||||
// BEGIN: load extensions
|
||||
$extensions = [
|
||||
"RequireJS",
|
||||
"CategoryTree",
|
||||
"Cite",
|
||||
// "ImageMap",
|
||||
"MultimediaViewer",
|
||||
// "Nuke",
|
||||
// "Renameuser",
|
||||
"ReplaceText",
|
||||
"ParserFunctions",
|
||||
"SyntaxHighlight_GeSHi",
|
||||
"Poem",
|
||||
// "MsUpload",
|
||||
// "WikiEditor",
|
||||
"MobileFrontend",
|
||||
"FontAwesome",
|
||||
// "Echo",
|
||||
// "CodeMirror",
|
||||
// "CodeEditor",
|
||||
// "CharInsert",
|
||||
// "TemplateStyles",
|
||||
"TimedMediaHandler",
|
||||
// "AdvancedSearch",
|
||||
// "RevisionSlider",
|
||||
// "Scribunto",
|
||||
// "Mpdf",
|
||||
// "ExpandableContent",
|
||||
"MonacoEditor",
|
||||
// "Spoilers",
|
||||
// "AutoCreateCategoryPages",
|
||||
// "CiteThisPage",
|
||||
// "TextExtracts",
|
||||
// "TitleBlacklist",
|
||||
// "Disambiguator",
|
||||
"OATHAuth",
|
||||
// "EmbedVideo",
|
||||
];
|
||||
foreach($extensions as $extension){
|
||||
$json_file = "$wgExtensionDirectory/$extension/extension.json";
|
||||
if( file_exists($json_file) ){
|
||||
wfLoadExtension($extension);
|
||||
}else{
|
||||
require_once "$wgExtensionDirectory/$extension/$extension.php";
|
||||
}
|
||||
}
|
||||
// END: load extensions
|
||||
|
||||
// $wgScribuntoDefaultEngine = 'luastandalone';
|
||||
// $wgMaxShellMemory = 204800; # in KB
|
||||
// $wgScribuntoEngineConf['luastandalone']['memoryLimit'] = 209715200; # bytes
|
||||
// $wgScribuntoEngineConf['luastandalone']['errorFile'] = "$IP/err.log";
|
||||
// $wgScribuntoEngineConf['luastandalone']['luaPath'] = '/usr/bin/lua5.1';
|
||||
|
||||
// Hide user toolbar settings
|
||||
$wgHiddenPrefs[] = 'usebetatoolbar';
|
||||
|
||||
// Configure "MsUpload", extension
|
||||
$wgMSU_useDragDrop = true;
|
||||
$wgMSU_showAutoCat = true;
|
||||
$wgMSU_checkAutoCat = true;
|
||||
$wgMSU_useMsLinks = false;
|
||||
|
||||
$wgShowExceptionDetails = true;
|
||||
|
||||
// Custom URL protocols
|
||||
$wgUrlProtocols[] = "grid://";
|
||||
|
||||
// Shared memory settings
|
||||
$wgMainCacheType = CACHE_ACCEL; // CACHE_NONE
|
||||
$wgMessageCacheType = CACHE_ACCEL;
|
||||
$wgCacheDirectory = "$IP/cache";
|
||||
$wgUseLocalMessageCache = true;
|
||||
$wgParserCacheType = CACHE_DB;
|
||||
$wgMemCachedServers = [];
|
||||
$wgUseGzip = true;
|
||||
$wgEnableSidebarCache = true;
|
||||
|
||||
// NO DB HITS!
|
||||
$wgDisableCounters = true;
|
||||
$wgMiserMode = true;
|
||||
|
||||
// Text cache
|
||||
$wgCompressRevisions = false; // use with care (see talk page)
|
||||
$wgRevisionCacheExpiry = 3*24*3600;
|
||||
$wgParserCacheExpireTime = 14*24*3600;
|
||||
$wgEnableSidebarCache = true;
|
||||
|
||||
$wgCapitalLinks = true; // @todo http://192.168.0.60/wiki/Special:WantedPages
|
||||
|
||||
// $wgObjectCaches['redis'] = [
|
||||
// 'class' => 'RedisBagOStuff',
|
||||
// 'servers' => [ '127.0.0.1:6379' ],
|
||||
// // 'connectTimeout' => 1,
|
||||
// // 'persistent' => false,
|
||||
// // 'password' => 'secret',
|
||||
// // 'automaticFailOver' => true,
|
||||
// ];
|
||||
|
||||
//$wgMainCacheType = CACHE_NONE;
|
||||
// $wgMainCacheType = 'redis';
|
||||
// $wgSessionCacheType = 'redis';
|
||||
|
||||
// Not widely tested
|
||||
// $wgMessageCacheType = 'redis';
|
||||
// $wgParserCacheType = 'redis';
|
||||
// $wgLanguageConverterCacheType = 'redis';
|
||||
|
||||
//$wgJobTypeConf['default'] = [
|
||||
// 'class' => 'JobQueueRedis',
|
||||
// 'redisServer' => '127.0.0.1:6379',
|
||||
// 'redisConfig' => [],
|
||||
// 'claimTTL' => 3600,
|
||||
// 'daemonized' => true
|
||||
// ];
|
||||
|
||||
// unset( $wgFooterIcons['poweredby'] );
|
||||
|
||||
// BEGIN: file changes
|
||||
// /includes/libs/mime/mime.types
|
||||
// text/plain txt js
|
||||
// END: file changes
|
||||
|
||||
//$wgWhitelistRead = [
|
||||
// "Main Page", "MediaWiki:Common.css", "MediaWiki:Common.js"
|
||||
//];
|
||||
|
||||
// Defautl user settings
|
||||
$wgDefaultUserOptions['watchdefault'] = false;
|
BIN
build/mediawiki_skins/MinervaNeue-REL1_38-d792d49.tar.gz
Normal file
BIN
build/mediawiki_skins/MinervaNeue-REL1_38-d792d49.tar.gz
Normal file
Binary file not shown.
BIN
build/mediawiki_skins/Vector-REL1_38-c7fa16c.tar.gz
Normal file
BIN
build/mediawiki_skins/Vector-REL1_38-c7fa16c.tar.gz
Normal file
Binary file not shown.
38
build/scripts/config_placeholder_replace.php
Normal file
38
build/scripts/config_placeholder_replace.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
if ($argc != 3) {
|
||||
die('error: invalid arg count');
|
||||
}
|
||||
|
||||
$config_path = $argv[1];
|
||||
$file_path = $argv[2];
|
||||
|
||||
$config = json_decode(file_get_contents($config_path), true);
|
||||
$content = file_get_contents($file_path);
|
||||
|
||||
foreach ($config as $key => $value) {
|
||||
/**
|
||||
* Transform from json to native config types
|
||||
*/
|
||||
// switch ($key) {
|
||||
// case 'POSTGREY_WHITELIST_DOMAINS':
|
||||
// $value = implode("\n", $value);
|
||||
// break;
|
||||
// case 'POSTFIXADMIN_SETUP_PASSWORD':
|
||||
// $value = password_hash($value, '2y');
|
||||
// break;
|
||||
// case 'ROUNDCUBE_PLUGIN_ALIAS_ADDRESSBOOK_DOMAINS':
|
||||
// $value = json_encode($value);
|
||||
// break;
|
||||
// case 'ROUNDCUBE_PLUGIN_ALIAS_ADDRESSBOOK_USERS':
|
||||
// $value = json_encode($value);
|
||||
// break;
|
||||
// case 'ROUNDCUBE_PLUGIN_X2FA_ENABLED_METHODS':
|
||||
// $value = json_encode($value);
|
||||
// break;
|
||||
// }
|
||||
|
||||
$content = str_replace('{{' . $key . '}}', $value, $content);
|
||||
}
|
||||
|
||||
exit(file_put_contents($file_path, $content) === false ? 1 : 0);
|
14
config.example.json
Normal file
14
config.example.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"SITE_NAME": "My Wiki",
|
||||
"SITE_EMERGENCY_CONTACT": "admin@example.com",
|
||||
"SITE_DOMAIN": "wiki.example.com",
|
||||
"SITE_LANG": "en",
|
||||
|
||||
"SITE_SECRET_KEY": "arq5hm5tahx5k7de0ruj5e26csnhbkv1fze4t8z0dfei1w4s2wlqhpjvmulnc3k0",
|
||||
"SITE_UPGRADE_KEY": "6nfta5i3nvl9tvlj",
|
||||
|
||||
"MYSQL_HOST": "127.0.0.1",
|
||||
"MYSQL_DB": "wiki.example.com",
|
||||
"MYSQL_USER": "wiki.example.com",
|
||||
"MYSQL_PASSWORD": "password"
|
||||
}
|
0
data/images/.gitkeep
Normal file
0
data/images/.gitkeep
Normal file
Reference in New Issue
Block a user