- 'wgNamespaceIds' => $wgContLang->getNamespaceIds(),
- 'wgSiteName' => $wgSitename,
- 'wgFileExtensions' => array_values( $wgFileExtensions ),
- 'wgDBname' => $wgDBname,
- 'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
- 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,
- );
- if ( $wgContLang->hasVariants() ) {
- $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
+ 'wgNamespaceIds' => $namespaceIds,
+ 'wgContentNamespaces' => MWNamespace::getContentNamespaces(),
+ 'wgSiteName' => $conf->get( 'Sitename' ),
+ 'wgDBname' => $conf->get( 'DBname' ),
+ 'wgExtraSignatureNamespaces' => $conf->get( 'ExtraSignatureNamespaces' ),
+ 'wgAvailableSkins' => Skin::getSkinNames(),
+ 'wgExtensionAssetsPath' => $conf->get( 'ExtensionAssetsPath' ),
+ // MediaWiki sets cookies to have this prefix by default
+ 'wgCookiePrefix' => $conf->get( 'CookiePrefix' ),
+ 'wgCookieDomain' => $conf->get( 'CookieDomain' ),
+ 'wgCookiePath' => $conf->get( 'CookiePath' ),
+ 'wgCookieExpiration' => $conf->get( 'CookieExpiration' ),
+ 'wgResourceLoaderMaxQueryLength' => $conf->get( 'ResourceLoaderMaxQueryLength' ),
+ 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
+ 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
+ 'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass( $illegalFileChars ),
+ 'wgResourceLoaderStorageVersion' => $conf->get( 'ResourceLoaderStorageVersion' ),
+ 'wgResourceLoaderStorageEnabled' => $conf->get( 'ResourceLoaderStorageEnabled' ),
+ 'wgForeignUploadTargets' => $conf->get( 'ForeignUploadTargets' ),
+ 'wgEnableUploads' => $conf->get( 'EnableUploads' ),
+ ];
+
+ Hooks::run( 'ResourceLoaderGetConfigVars', [ &$vars ] );
+
+ $this->configVars[$hash] = $vars;
+ return $this->configVars[$hash];
+ }
+
+ /**
+ * Recursively get all explicit and implicit dependencies for to the given module.
+ *
+ * @param array $registryData
+ * @param string $moduleName
+ * @return array
+ */
+ protected static function getImplicitDependencies( array $registryData, $moduleName ) {
+ static $dependencyCache = [];
+
+ // The list of implicit dependencies won't be altered, so we can
+ // cache them without having to worry.
+ if ( !isset( $dependencyCache[$moduleName] ) ) {
+ if ( !isset( $registryData[$moduleName] ) ) {
+ // Dependencies may not exist
+ $dependencyCache[$moduleName] = [];
+ } else {
+ $data = $registryData[$moduleName];
+ $dependencyCache[$moduleName] = $data['dependencies'];
+
+ foreach ( $data['dependencies'] as $dependency ) {
+ // Recursively get the dependencies of the dependencies
+ $dependencyCache[$moduleName] = array_merge(
+ $dependencyCache[$moduleName],
+ self::getImplicitDependencies( $registryData, $dependency )
+ );
+ }
+ }