From 0e02d2f4cbbb7ebcfeda24e6c16b6792b7f7ba5e Mon Sep 17 00:00:00 2001 From: Krinkle Date: Thu, 16 Jun 2011 21:20:05 +0000 Subject: [PATCH] (bug 29441) Expose CapitalLinks config in JS to allow modules to properly handle titles on case-sensitive wikis. This brings us one step closer towards: (bug 29397) Implement mw.Title module in core --- .../ResourceLoaderStartUpModule.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index a7c15a2cca..8ce592e01c 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -55,14 +55,21 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { ); $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) + /** + * Namespace related preparation + * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces. + * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive. + */ $namespaceIds = $wgContLang->getNamespaceIds(); + $caseSensitiveNamespaces = array(); foreach( MWNamespace::getCanonicalNamespaces() as $index => $name ) { $namespaceIds[$wgContLang->lc( $name )] = $index; + if ( !MWNamespace::isCapitalized( $index ) ) { + $caseSensitiveNamespaces[] = $index; + } } + $serverBits = wfParseUrl( $wgServer ); $protocol = $serverBits ? $serverBits['scheme'] : 'http'; @@ -106,6 +113,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgLegacyJavaScriptGlobals' => $wgLegacyJavaScriptGlobals, + 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, ); if ( $wgUseAjax && $wgEnableMWSuggest ) { $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); @@ -263,4 +271,4 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { public function getGroup() { return 'startup'; } -} \ No newline at end of file +} -- 2.20.1