r90232 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90231‎ | r90232 | r90233 >
Date:21:16, 16 June 2011
Author:krinkle
Status:reverted (Comments)
Tags:
Comment:
Implement mw.Title in core
* Based on UploadWizard/resources/mw.Title.js
* Refactored to use local scope and prototypes instead of per-instance private scope (less references, faster instantiation)
* Fix potential ReferenceError in the check for wgArticlePath (inline if statements will fail to evaluate for undeclared variables). Using mw.config instead
* The following were not ported because they are or were already redundant and/or merged with another method:
-- setNameText (redundant with the improved setName)
-- setPrefix (redundant wit the improved setNamespace)
* Ported all jasmine tests to QUnit. Left them exactly the same to make sure it's compatible with UploadWizard. Perhaps I'll expand or adjust the suite later to be less file-specific, but for now make sure it's compatible and the same.



@todo FIXME

* Removed assumption that every title has a namespace prefix in it by creating a separate RegExp when there is a namespace given

** Fixes strip-bug in cases where a namespace appears to be part of a title when the namespace is also given: "Project:User:Foobar"

new mw.Title( 'User:Foobar', 4 ).toString()
> 'Project:Foobar'

** Fixes a thrown exception in case a colon is part of the title (colons are valid in MediaWiki pagenames!)

new mw.Title( 'Just some:Random page')
> Error: mw.Title> Unrecognized canonical namespace: just_some

* Added check for capitalLinks et (wasn't possible before due to bug X)

** Prevents breakages on wiktionary and other wikis with case sensitivity.
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();

Follow-up revisions

RevisionCommit summaryAuthorDate
r90233Revert r90232.krinkle21:18, 16 June 2011

Comments

#Comment by Krinkle (talk | contribs)   21:19, 16 June 2011

Self-reverting r90233. I messed up horribly in svn. Git *dun dun dun*

Status & tagging log