zhtest / LocalSettings.php
arolstar52's picture
Upload 9 files
039c290 verified
Raw
History Blame Contribute Delete
3.77 kB
<?php
$wgSitename = "Local Chinese Wikipedia";
$wgMetaNamespace = "Project";
$wgScriptPath = "";
// Prefer MW_SERVER if set. Otherwise use the current Host header.
$wgServer = getenv("MW_SERVER") ?: "https://" . ($_SERVER['HTTP_HOST'] ?? "localhost:7860");
$wgCanonicalServer = $wgServer;
$wgResourceBasePath = $wgScriptPath;
$wgLanguageCode = "zh";
$wgDefaultLanguageVariant = "zh-cn";
$wgDisableLangConversion = false;
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
$wgDBtype = "mysql";
$wgDBserver = "localhost:/run/mysqld/mysqld.sock";
$wgDBname = getenv("MW_DB_NAME") ?: "zhwiki";
$wgDBuser = getenv("MW_DB_USER") ?: "wiki";
$wgDBpassword = getenv("MW_DB_PASSWORD") ?: "wiki_pass";
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
$wgSecretKey = getenv("MW_SECRET_KEY") ?: "CHANGE_THIS_TO_A_LONG_RANDOM_SECRET_STRING_zhwiki_local";
$wgUpgradeKey = getenv("MW_UPGRADE_KEY") ?: "CHANGE_THIS_UPGRADE_KEY";
$wgEnableUploads = false;
$wgCompressRevisions = true;
// Flow requires an object cache. DB-backed cache is heavier than memcached,
// but avoids adding another daemon in a Hugging Face single-container Space.
$wgMainCacheType = CACHE_DB;
$wgMessageCacheType = CACHE_DB;
$wgParserCacheType = CACHE_DB;
$wgCacheDirectory = "/data/tmp";
$wgJobRunRate = 0;
wfLoadSkin( 'Vector' );
$wgDefaultSkin = 'vector';
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'Cite' );
wfLoadExtension( 'Scribunto' );
wfLoadExtension( 'TemplateStyles' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
wfLoadExtension( 'JsonConfig' );
wfLoadExtension( 'GeoData' );
wfLoadExtension( 'Kartographer' );
// zhwiki templates/modules call mw.wikibase from Lua. Full Wikibase Client
// requires a large extension with git submodules and a Wikidata/repo setup.
// For a read-only/offline Wikipedia mirror, default to a tiny local Scribunto
// stub that exposes mw.wikibase and returns empty/nil data instead of crashing.
// Set WIKIBASE_CLIENT_MODE=0 to disable the stub. Set WIKIBASE_CLIENT_MODE=full
// only if you provide a complete Wikibase extension and repository configuration.
$wikibaseClientMode = getenv( 'WIKIBASE_CLIENT_MODE' ) ?: 'lite';
if ( $wikibaseClientMode === 'full' && is_file( "$IP/extensions/Wikibase/extension-client.json" ) ) {
wfLoadExtension( 'WikibaseClient', "$IP/extensions/Wikibase/extension-client.json" );
if ( is_file( "$IP/extensions/Wikibase/client/ExampleSettings.php" ) ) {
require_once "$IP/extensions/Wikibase/client/ExampleSettings.php";
}
} elseif ( $wikibaseClientMode !== '0' && is_file( "$IP/extensions/WikibaseClientLite/extension.json" ) ) {
wfLoadExtension( 'WikibaseClientLite' );
}
// Parsoid is bundled with MediaWiki 1.43. StructuredDiscussions strongly
// recommends Parsoid, and WMF Flow deployments use HTML content format.
// Use the internal Apache endpoint so CLI/background import can reach rest.php
// even when MW_SERVER is the public Hugging Face URL.
wfLoadExtension( 'Parsoid', "$IP/vendor/wikimedia/parsoid/extension.json" );
$wgVirtualRestConfig['modules']['parsoid'] = [
'url' => 'http://localhost:7860/rest.php',
'domain' => 'localhost',
'prefix' => 'localhost',
];
// Real Flow / StructuredDiscussions support.
// Echo is a required dependency of StructuredDiscussions.
wfLoadExtension( 'Echo' );
wfLoadExtension( 'MassMessage' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'SecurePoll' );
wfLoadExtension( 'Flow' );
// Match WMF-style Flow storage more closely by using Parsoid-backed HTML.
$wgFlowContentFormat = 'html';
$wgFlowServerCompileTemplates = false;
$wgScribuntoDefaultEngine = 'luastandalone';
$wgEnableEmail = false;
$wgEnableUserEmail = false;
$wgShowExceptionDetails = true;
$wgShowDBErrorBacktrace = true;
$wgDebugLogFile = false;