resourceloader: Add wgWikiID to mw.config in the startup module
authorRoan Kattouw <roan.kattouw@gmail.com>
Thu, 4 Jul 2019 01:41:07 +0000 (18:41 -0700)
committerCatrope <roan@wikimedia.org>
Tue, 3 Sep 2019 17:48:23 +0000 (17:48 +0000)
This was previously just added by Echo, but it's generally useful.

We should probably deprecate wgDBname, because wgWikiID is a better wiki
identifier that also works when two wikis have different table prefixes
in the same database, but that'll take some work because a number of
things rely on it right now (including ResourceLoader itself, for its
localStorage keys).

Change-Id: I4d289267991f1f9a8e0710ec6ee5a2131306c510

includes/resourceloader/ResourceLoaderStartUpModule.php

index 58c9ee5..942b0e5 100644 (file)
@@ -104,6 +104,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        'wgContentNamespaces' => $nsInfo->getContentNamespaces(),
                        'wgSiteName' => $conf->get( 'Sitename' ),
                        'wgDBname' => $conf->get( 'DBname' ),
+                       'wgWikiID' => WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() ),
                        'wgExtraSignatureNamespaces' => $conf->get( 'ExtraSignatureNamespaces' ),
                        'wgExtensionAssetsPath' => $conf->get( 'ExtensionAssetsPath' ),
                        // MediaWiki sets cookies to have this prefix by default