r90234 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90233‎ | r90234 | r90235 >
Date:21:20, 16 June 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
(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) (history)

Diff [purge]

Index: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -55,14 +55,21 @@
5656 );
5757 $mainPage = Title::newMainPage();
5858
59 - // Build wgNamespaceIds
60 - // A complete key-value pair object mapping localized, canonical and aliases for namespaces
61 - // to their numerical ids (case insensitive and with underscores)
 59+ /**
 60+ * Namespace related preparation
 61+ * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
 62+ * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
 63+ */
6264 $namespaceIds = $wgContLang->getNamespaceIds();
 65+ $caseSensitiveNamespaces = array();
6366 foreach( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
6467 $namespaceIds[$wgContLang->lc( $name )] = $index;
 68+ if ( !MWNamespace::isCapitalized( $index ) ) {
 69+ $caseSensitiveNamespaces[] = $index;
 70+ }
6571 }
6672
 73+
6774 $serverBits = wfParseUrl( $wgServer );
6875 $protocol = $serverBits ? $serverBits['scheme'] : 'http';
6976
@@ -106,6 +113,7 @@
107114 'wgCookiePrefix' => $wgCookiePrefix,
108115 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,
109116 'wgLegacyJavaScriptGlobals' => $wgLegacyJavaScriptGlobals,
 117+ 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
110118 );
111119 if ( $wgUseAjax && $wgEnableMWSuggest ) {
112120 $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate();
@@ -263,4 +271,4 @@
264272 public function getGroup() {
265273 return 'startup';
266274 }
267 -}
\ No newline at end of file
 275+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r90235Release-notes for r90234krinkle21:22, 16 June 2011
r90331Implement mw.Title in core...krinkle09:17, 18 June 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   21:55, 16 June 2011

Looks good; should be able to do a simple $.inArray() on the NS id to get the setting.

Status & tagging log