WikiOasis runs multiple MediaWiki versions simultaneously on the same hardware, and every wiki can be pinned to a specific version independently of the farm default. This capability is essential for testing extension compatibility, staging major upgrades, and giving individual wikis a controlled upgrade path. The version resolution pipeline — implemented acrossDocumentation 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.
MirahezeFunctions, WikiFarmMultiVersion, and wikiVersions.php — is designed for zero-downtime operation: version writes use an atomic tmp-file rename so no request ever reads a partially written file, and the CreateWiki cache propagates version data so MirahezeFunctions::getMediaWikiVersion() rarely needs to hit the filesystem at all.
Farm Version Constants
The three named version tracks are defined inMirahezeFunctions::MEDIAWIKI_VERSIONS:
stable
1.45 — The production default. All newly created wikis run on this version unless explicitly overridden.
beta
1.45 — Used on the
betaoasis.xyz realm (hostname staging11). Beta-realm wikis default to this track.alpha
1.46 — The bleeding-edge track. Available for opt-in via
managewiki-restricted; not recommended for production wikis.Default Version Selection
MirahezeFunctions::getDefaultMediaWikiVersion() determines the farm-wide fallback:
staging11 hostname (the beta cluster), the default track is beta. On all production servers, it is stable. This value is then resolved to its concrete version string via resolveMediaWikiVersion(), which looks up the track name in MEDIAWIKI_VERSIONS — falling back to treating the input as a literal version string if no matching track is found.
Version Resolution for a Specific Wiki
MirahezeFunctions::getMediaWikiVersion(?string $database = null): string resolves the version for a given database, following this priority chain:
- Environment variable — If
MIRAHEZE_WIKI_VERSIONis set, it takes absolute precedence (useful for maintenance runs). - wikiVersions.php — The override file at
/srv/mediawiki/config/wikiVersions.phpis checked first. If the$databasekey is present, that version is used immediately. - databases.php cache — The
vkey in the wiki’scw_cache/databases.phpentry is read. This is populated by theCreateWikiPhpBuilderhook. - Farm default —
MEDIAWIKI_VERSIONS[getDefaultMediaWikiVersion()]is used as the final fallback.
/srv/mediawiki/versions/{version}/maintenance/...).
wikiVersions.php File Format
wikiVersions.php is a plain PHP file that returns a simple associative array. It lives at /srv/mediawiki/config/wikiVersions.php and is managed exclusively by WikiFarmMultiVersion::setWikiVersion() — never edited by hand.
@include (suppressing missing-file errors) so a completely empty or absent file is handled gracefully.
WikiFarmMultiVersion API
getWikiVersion()
wikiVersions.php and returns the version string for $dbname, or the farm default if no override exists. This is a lightweight read used for display purposes (e.g., in the ManageWiki core form).
setWikiVersion()
wikiVersions.php. The update strategy:
- Reads the current contents of
wikiVersions.php. - If
$versionisnullor equals the current farm default, removes the entry for$dbname(reverting to default). - Otherwise, sets
$versions[$dbname] = $version. - Writes the new array to a temporary file named
wikiVersions.php.tmp.{pid}usingLOCK_EX. - Atomically replaces
wikiVersions.phpwith the temp file usingrename(). - Deletes the wiki’s CreateWiki cache file (
cw_cache/{dbname}.php) to force a cache rebuild on the next request.
onCreateWikiPhpBuilder()
databases.php cache entry for a wiki. It injects the wiki’s wikiVersions.php override — if one exists — into $cacheData['v'], ensuring that the fast-path getMediaWikiVersion() lookup from the databases cache returns the correct version without re-reading wikiVersions.php on every request.
Filesystem Path Resolution
MirahezeFunctions::getMediaWiki(string $file): string resolves the full filesystem path to a MediaWiki file for the current wiki’s version:
MEDIAWIKI_DIRECTORY is /srv/mediawiki/versions. Each version track has its own subdirectory — e.g., /srv/mediawiki/versions/1.45/ and /srv/mediawiki/versions/1.46/. If the resolved version directory does not exist (e.g., 1.46 has not yet been deployed to a server), the function falls back to MEDIAWIKI_DIRECTORY itself.
Pinning a Wiki to a Specific Version
Verify the version exists on the server
The ManageWiki core form only lists versions for which a directory exists under
/srv/mediawiki/versions/. Check with a steward or tech team member if the desired version is not available in the selector.Navigate to Special:ManageWiki/core
Go to
Special:ManageWiki/core on the target wiki (or on metawiki for a different wiki, entering its database name). You must hold the managewiki-restricted right or be acting as a steward.Select the MediaWiki version
In the MediaWiki version dropdown (added by
onManageWikiCoreAddFormFields), select the desired version. The dropdown is disabled for users without managewiki-restricted.Save the form
Click Save. The
onManageWikiCoreFormSubmission handler calls WikiFarmMultiVersion::setWikiVersion($dbname, $mediawikiVersion) immediately, updating wikiVersions.php atomically and invalidating the wiki’s CreateWiki cache. The new version takes effect on the very next request to that wiki.