http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90234
Revision: 90234 Author: krinkle Date: 2011-06-16 21:20:05 +0000 (Thu, 16 Jun 2011) Log Message: ----------- (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 Modified Paths: -------------- trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php Modified: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php =================================================================== --- trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php 2011-06-16 21:18:40 UTC (rev 90233) +++ trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php 2011-06-16 21:20:05 UTC (rev 90234) @@ -55,14 +55,21 @@ ); $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 @@ 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgLegacyJavaScriptGlobals' => $wgLegacyJavaScriptGlobals, + 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, ); if ( $wgUseAjax && $wgEnableMWSuggest ) { $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); @@ -263,4 +271,4 @@ public function getGroup() { return 'startup'; } -} \ No newline at end of file +} _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs