protected function getConfig( $context ) {
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension,
$wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
- $wgVariantArticlePath, $wgActionPaths, $wgUseAjax,
+ $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion,
$wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest,
- $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgProto,
+ $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
$wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgLegacyJavaScriptGlobals;
// Pre-process information
);
$mainPage = Title::newMainPage();
+ // Build wgNamespaceIds
+ // A complete key-value pair object mapping localized, canonical and aliases for namespaces
+ // to their numerical ids (case insensitive and with underscores)
+ $namespaceIds = $wgContLang->getNamespaceIds();
+ foreach( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
+ $namespaceIds[$wgContLang->lc( $name )] = $index;
+ }
+
+ $serverBits = wfParseUrl( $wgServer );
+ $protocol = $serverBits ? $serverBits['scheme'] : 'http';
+
// Build list of variables
$vars = array(
'wgLoadScript' => $wgLoadScript,
'wgServer' => $wgServer,
'wgUserLanguage' => $context->getLanguage(),
'wgContentLanguage' => $wgContLang->getCode(),
- 'wgVersion' => MW_VERSION,
+ 'wgVersion' => $wgVersion,
'wgEnableAPI' => $wgEnableAPI,
'wgEnableWriteAPI' => $wgEnableWriteAPI,
'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(),
'wgDigitTransformTable' => $compactDigitTransTable,
'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null,
'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
- 'wgNamespaceIds' => $wgContLang->getNamespaceIds(),
+ 'wgNamespaceIds' => $namespaceIds,
'wgSiteName' => $wgSitename,
'wgFileExtensions' => array_values( $wgFileExtensions ),
'wgDBname' => $wgDBname,
'wgFileCanRotate' => BitmapHandler::canRotate(),
'wgAvailableSkins' => Skin::getSkinNames(),
'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
- 'wgProto' => $wgProto,
+ 'wgProto' => $protocol,
// MediaWiki sets cookies to have this prefix by default
'wgCookiePrefix' => $wgCookiePrefix,
'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,
/* Methods */
+ /**
+ * @param $context ResourceLoaderContext
+ * @return string
+ */
public function getScript( ResourceLoaderContext $context ) {
global $IP, $wgLoadScript, $wgLegacyJavaScriptGlobals;
}
// Build load query for StartupModules
$query = array(
- 'modules' => implode( '|', $modules ),
+ 'modules' => ResourceLoader::makePackedModulesString( $modules ),
'only' => 'scripts',
'lang' => $context->getLanguage(),
'skin' => $context->getSkin(),
return $out;
}
+ /**
+ * @param $context ResourceLoaderContext
+ * @return array|mixed
+ */
public function getModifiedTime( ResourceLoaderContext $context ) {
global $IP, $wgCacheEpoch;
}
return $this->modifiedTime[$hash] = $time;
}
-
+
/* Methods */
-
+
+ /**
+ * @return string
+ */
public function getGroup() {
return 'startup';
}
-}
+}
\ No newline at end of file