Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/wikioasis/mw-config/llms.txt

Use this file to discover all available pages before exploring further.

LocalSettings.php is the single file that MediaWiki loads first on every request across the WikiOasis farm. It does not simply hold static configuration — it is an orchestration script that validates the entry point, pulls in credentials, resolves which wiki is being served, builds the full $wgConf->settings tree for SiteConfiguration, and then includes every downstream config file in the correct order. Nothing in the farm works without understanding this file’s structure and sequencing.
Never edit LocalSettings.php directly on production without a full understanding of the load chain. A syntax error or misordered require_once will take down every wiki simultaneously. All changes should be reviewed, version-controlled, and tested on the staging environment (hostname staging11) before being deployed.

Load Order

When MediaWiki bootstraps, LocalSettings.php runs a strict sequence of includes and object instantiation steps. Understanding the order is critical, because each step depends on what the previous one established.
1

Entry Point Guards

Three defined() checks at the top of the file abort execution if MEDIAWIKI, CACHE_MEMCACHED, or MW_ENTRY_POINT are not already defined, preventing direct web access to the config file.
2

PrivateSettings.php

require_once "$IP/config/PrivateSettings.php" loads database credentials, secret keys, R2/S3 credentials, Sentry DSN, and OAuth key paths from /srv/mediawiki/config/PrivateSettings.php. This file is not in the repository.
3

Virtual Domain Mapping

Based on whether php_uname('n') returns staging11 (the staging hostname), virtual domains are mapped to wikidbbeta / metawikibeta (staging) or wikidb / metawiki (production). See the Environment Detection section below.
4

MirahezeFunctions.php

require_once "$IP/config/MirahezeFunctions.php" defines the MirahezeFunctions class, which provides all farm-level helpers for resolving databases, servers, versions, and extensions.
5

GlobalExtensions.php

require_once "$IP/config/GlobalExtensions.php" loads extensions that must be active on every wiki regardless of ManageWiki settings.
6

MirahezeFunctions instantiation

$wi = new MirahezeFunctions() resolves the current wiki’s database name, server URL, site name, MediaWiki version, and cluster assignments. All subsequent code in LocalSettings.php uses $wi.
7

$wgConf->settings population

The large $wgConf->settings += block registers per-wiki configuration for every extension and core MediaWiki setting. Values can be keyed by wiki DB name for per-wiki overrides.
8

ManageWikiExtensions.php

ManageWikiExtensions.php is included immediately after the $wgConf->settings block. It defines the full registry of extensions and skins available for per-wiki selection through ManageWiki. After this, MirahezeFunctions::getConfigGlobals() resolves the current wiki’s configuration from SiteConfiguration, and $wi->loadExtensions() activates the extensions the wiki has enabled.
9

ManageWikiNamespaces.php and ManageWikiSettings.php

After extract($globals) applies the resolved per-wiki globals, ManageWikiNamespaces.php applies per-wiki namespace configuration and ManageWikiSettings.php applies per-wiki settings — both read from the database by ManageWiki.
10

Final includes

Database.php, GlobalCache.php, GlobalSettings.php, and LocalWiki.php are included last in that order. GlobalSettings.php registers farm-wide hooks and conditionally loads optional extensions. See each file’s documentation for details.

Environment Detection

The farm distinguishes between staging and production purely by hostname. If php_uname('n') === 'staging11', all virtual domain mappings point to the wikidbbeta / metawikibeta databases. Otherwise, production databases are used.
if ( php_uname( 'n' ) === 'staging11' ) {
    $wgVirtualDomainsMapping['virtual-centralauth'] = ['db' => 'wikidbbeta'];
    $wgVirtualDomainsMapping['virtual-createwiki']  = ['db' => 'wikidbbeta'];
    // ...all other virtual domains → wikidbbeta / metawikibeta
} else {
    $wgVirtualDomainsMapping['virtual-centralauth'] = ['db' => 'wikidb'];
    $wgVirtualDomainsMapping['virtual-createwiki']  = ['db' => 'wikidb'];
    // ...all other virtual domains → wikidb / metawiki
}
Full virtual domain mapping (production):
Virtual DomainDatabase
virtual-centralauthwikidb
virtual-checkuser-globalwikidb
virtual-createwikiwikidb
virtual-createwiki-centralmetawiki
virtual-globalblockingwikidb
virtual-managewikiwikidb
virtual-oathauthwikidb
virtual-LoginNotifywikidb
virtual-importdumpmetawiki
virtual-requestcustomdomainmetawiki
virtual-interwikimetawiki
virtual-interwiki-interlanguagemetawiki

Shared Domain Detection

When the HTTP_HOST header matches the shared/CentralAuth domain (accounts.wikioasis.org), or the MW_USE_SHARED_DOMAIN environment variable is set, LocalSettings.php activates shared-domain mode:
if ( ( $_SERVER['HTTP_HOST'] ?? '' ) === $wi->getSharedDomain()
    || getenv( 'MW_USE_SHARED_DOMAIN' )
) {
    $wgLoadScript  = "{$wi->server}/w/load.php";
    $wmgSharedDomainPathPrefix = "/$wgDBname";
    $wgCanonicalServer = 'https://' . $wi->getSharedDomain();
    $wgUseSiteCss = false;
    $wgUseSiteJs  = false;
}
In shared-domain mode:
  • $wgLoadScript is redirected to the wiki’s own origin rather than the shared domain.
  • $wgCanonicalServer becomes https://accounts.wikioasis.org.
  • $wgUseSiteCss and $wgUseSiteJs are both set to false, preventing wiki-specific CSS/JS from running during the CentralAuth SSO flow.
  • $wgArticlePath gets the per-wiki path prefix (e.g. /metawiki/wiki/$1).

Path Configuration

All resource paths are constructed from the resolved MediaWiki version so that multiple MediaWiki releases can coexist on the same host:
$wgScriptPath        = $wmgSharedDomainPathPrefix ?: '/w';
$wgScript            = "$wgScriptPath/index.php";
$wgResourceBasePath  = ( $wmgSharedDomainPathPrefix ?: '' ) . '/versions/' . $wi->version;
$wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
$wgStylePath           = "$wgResourceBasePath/skins";
For example, a wiki running on the 1.45 stable channel will have $wgResourceBasePath = /versions/1.45, meaning all extension and skin assets are served from /versions/1.45/extensions/ and /versions/1.45/skins/.

$wgConf->settings Categories

The bulk of LocalSettings.php is a large $wgConf->settings += block. Settings are keyed by MediaWiki variable name; values are arrays where 'default' applies farm-wide and additional keys override per wiki.
SettingDefaultPer-wiki Override
wgMaxArticleSize2048 KB (2 MB)projectherzlwiki → 49152 KB (48 MB); smowiki → 10240 KB (10 MB)
wgAPIMaxResultSize4194304 bytes (4 MB)projectherzlwiki → ~100 MB
wgHTTPTimeout3 seconds
wgDeleteRevisionsLimit1000
wgCategoryPagingLimit200italianbrainrotwiki → 50
Jobs are not run inline on web requests (wgJobRunRate = 0); they are processed by a dedicated job runner via Redis.
SettingValue
wgEnableEmailtrue
wgEnableUserEmailtrue
wgPasswordSendernoreply@wikioasis.org
wgEnotifUserTalktrue
wgEnotifWatchlisttrue
wgEmailAuthenticationtrue
wgMediaModerationFrom and wgMediaModerationRecipientList both also use noreply@wikioasis.org and safety@wikioasis.org respectively.
All uploads use the Cloudflare R2/S3 backend with the AmazonS3FileBackend class. The bucket is wikioasis-media and files are stored in a per-wiki subdirectory (/$wgDBname).
SettingValue
wgEnableUploadstrue
wgMaxUploadSize134217728 bytes (128 MB)
wgAWSBucketNamewikioasis-media
wgAWSBucketDomainhttps://cdn.wikioasis.org
wgAWSBucketTopSubdirectory/{$wgDBname}
wgUseImageMagicktrue (/usr/bin/convert)
wgSVGNativeRenderingtrue
Allowed file extensions (default): djvu, gif, ico, jpg, jpeg, ogg, pdf, png, svg, webpGlobal shared containers (used across all wikis for SocialProfile/UserProfileV2):
ContainerBucket Path
avatarswikioasis-media/avatars
awardswikioasis-media/awards
upv2avatarswikioasis-media/upv2avatars
For private wikis, $wgUploadPath is set to /w/img_auth.php and public read on the bucket zones is revoked. Public wikis retain $wgGroupPermissions['*']['read'] = true.
Both wgDefaultSkin and wgDefaultMobileSkin are set to citizen, meaning every wiki uses the Citizen skin on both desktop and mobile unless overridden per-wiki through ManageWiki.
SettingValue
wgCentralAuthLoginWikiloginwiki
wgCentralAuthCentralWikimetawiki (beta: metawikibeta)
wgCentralAuthDatabasewikidb (beta: wikidbbeta)
wgCentralAuthPreventUnattachedtrue
wgCentralAuthRestrictSharedDomaintrue
wgCentralAuthAutoMigratetrue
wgCentralAuthAutoMigrateNonGlobalAccountstrue
wgCentralAuthEnableGlobalRenameRequesttrue
wgCentralAuthTokenCacheTyperedis
wgCookieSameSiteNone
wgUseSameSiteLegacyCookiestrue
Auto-create wikis on login: loginwiki and metawiki. $wgCentralAuthStrict = true and SUL3 ($wgCentralAuthEnableSul3 = true) are set in GlobalSettings.php.
SettingValue
wgCreateWikiSubdomainwikioasis.org
wgCreateWikiDatabasewikidb
wgCreateWikiDatabaseSuffixwiki
wgCreateWikiGlobalWikimetawiki
wgCreateWikiCacheDirectory/srv/mediawiki/cw_cache
wgCreateWikiCacheTyperedis
wgCreateWikiUseJobQueuetrue
Wiki lifecycle state days:
StateDays
Inactive90
Closed30
Removed245
Deleted30
Features enabled: categories, closed wikis, custom domains, Echo notifications, experimental wikis, inactive wikis, private wikis, biographical option.
All five ManageWiki modules are enabled farm-wide:
'wgManageWikiModulesEnabled' => [
    'default' => [
        'core'        => true,
        'extensions'  => true,
        'namespaces'  => true,
        'permissions' => true,
        'settings'    => true,
    ],
],
Default extensions enabled on every new wiki (wgManageWikiExtensionsDefault):categorytree, cite, citethispage, codeeditor, codemirror, darkmode, globaluserpage, minervaneue, mobilefrontend, syntaxhighlight_geshi, textextracts, urlshortener, wikiseo
SettingValue
wgAbuseFilterCentralDBmetawiki
wgAbuseFilterIsCentraltrue on metawiki only
wgAbuseFilterBlockDurationindefinite
wgAbuseFilterAnonBlockDuration2592000 seconds (30 days)
wgAbuseFilterNotificationsudp
wgAbuseFilterLogPrivateDetailsAccesstrue
wgAbuseFilterPrivateDetailsForceReasontrue
Enabled actions: block, blockautopromote, degroup, disallow, tag, throttle, warn. Range blocks are disabled (rangeblock => false).
Temporary accounts are enabled globally for anonymous edits.
SettingValue
enabledtrue
actions['edit']
genPattern~$1
reservedPattern~$1
serialProvidercentralauth (with useYear: true)
serialMappingreadable-numeric
expireAfterDays90
notifyBeforeExpirationDays10
wgUseCdn = true is set globally. The wgCdnServersNoPurge array whitelists all Cloudflare IP ranges plus the two internal proxy servers so that purge requests from those IPs are treated as trusted CDN traffic:Internal proxy servers: 10.0.1.2 (proxy-us-east-011), 10.0.2.2 (proxy-us-east-021)Cloudflare IPv4 ranges (sample): 103.21.244.0/22, 104.16.0.0/13, 162.158.0.0/15, 172.64.0.0/13, 173.245.48.0/20, and others.Cloudflare IPv6 ranges: 2400:cb00::/32, 2606:4700::/32, 2803:f800::/32, and others.Cloudflare cache purge is handled by the CFCachePurge extension, configured with wgCFCachePurgePurgeableImageHosts = ['cdn.wikioasis.org'].

Final Include Chain

After $wgConf->settings is fully populated, LocalSettings.php includes the remaining configuration files in this order:
ManageWikiExtensions.php   → defines the registry of available extensions and skins
  [getConfigGlobals()]     → resolves per-wiki SiteConfiguration globals
  [loadExtensions()]       → activates the wiki's enabled extensions
ManageWikiNamespaces.php   → applies per-wiki namespace configuration
ManageWikiSettings.php     → applies per-wiki settings from ManageWiki
Database.php               → configures LBFactoryMulti and cluster routing
GlobalCache.php            → sets Redis/Memcached cache types and TTLs
GlobalSettings.php         → farm-wide hooks, conditional extension loading
LocalWiki.php              → per-server or per-environment local overrides
GlobalSettings.php is deliberately included after ManageWikiSettings.php so that per-wiki settings retrieved from the database by ManageWiki are already in place when GlobalSettings runs its extension-loading conditionals.

Localisation Cache

The localisation cache uses LCStoreStaticArray (PHP static files) stored in a per-version directory so that simultaneous deployments of different MediaWiki versions do not collide:
$wgLocalisationCacheConf['storeClass']     = LCStoreStaticArray::class;
$wgLocalisationCacheConf['storeDirectory'] = '/srv/mediawiki/cache/' . MirahezeFunctions::getMediaWikiVersion();
$wgLocalisationCacheConf['manualRecache']  = true;
If the en.l10n.php file does not yet exist in the cache directory (e.g., after a fresh deployment), manualRecache is automatically set to false so MediaWiki rebuilds it on the next request.

StatsD / Observability

Metrics are emitted in DogStatsD format to the internal monitoring host:
$wgStatsFormat   = 'dogstatsd';
$wgStatsTarget   = 'udp://monitoring-us-east-021.ovvin.wonet:9125';
$wgWMEStatsdBaseUri = 'udp://monitoring-us-east-021.ovvin.wonet:9125';
Error tracking uses Sentry, loaded via require_once __DIR__ . '/Sentry.php' with the DSN sourced from $sentryDSN in PrivateSettings.php.

Build docs developers (and LLMs) love