r97859 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97858‎ | r97859 | r97860 >
Date:21:39, 22 September 2011
Author:brion
Status:ok
Tags:
Comment:
MFT r97857 to 1.18wmf1 -- regression from r86255 (bug 31100)
Modified paths:
  • /branches/wmf/1.18wmf1/includes/Title.php (modified) (history)
  • /branches/wmf/1.18wmf1/tests/phpunit/includes/TitleTest.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/tests/phpunit/includes/TitleTest.php
@@ -15,4 +15,26 @@
1616 }
1717 }
1818
 19+ /**
 20+ * @dataProvider dataBug31100
 21+ */
 22+ function testBug31100FixSpecialName( $text, $expectedParam ) {
 23+ $title = Title::newFromText( $text );
 24+ $fixed = $title->fixSpecialName();
 25+ $stuff = explode( '/', $fixed->getDbKey(), 2 );
 26+ if ( count( $stuff ) == 2 ) {
 27+ $par = $stuff[1];
 28+ } else {
 29+ $par = null;
 30+ }
 31+ $this->assertEquals( $expectedParam, $par, "Bug 31100 regression check: Title->fixSpecialName() should preserve parameter" );
 32+ }
 33+
 34+ function dataBug31100() {
 35+ return array(
 36+ array( 'Special:Version', null ),
 37+ array( 'Special:Version/', '' ),
 38+ array( 'Special:Version/param', 'param' ),
 39+ );
 40+ }
1941 }
Index: branches/wmf/1.18wmf1/includes/Title.php
@@ -4114,9 +4114,9 @@
41154115 */
41164116 public function fixSpecialName() {
41174117 if ( $this->getNamespace() == NS_SPECIAL ) {
4118 - list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform );
 4118+ list( $canonicalName, $par ) = SpecialPageFactory::resolveAlias( $this->mDbkeyform );
41194119 if ( $canonicalName ) {
4120 - $localName = SpecialPageFactory::getLocalNameFor( $canonicalName );
 4120+ $localName = SpecialPageFactory::getLocalNameFor( $canonicalName, $par );
41214121 if ( $localName != $this->mDbkeyform ) {
41224122 return Title::makeTitle( NS_SPECIAL, $localName );
41234123 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86255Refactor the factory/i18n/list/etc static methods from SpecialPage into their...happy-melon11:31, 17 April 2011
r97857* (bug 31100) Fix regression in sidebar (special: page links lost parameters)...brion21:35, 22 September 2011
r97858MFT r97857 to 1.18 -- regression from r86255 (bug 31100)brion21:38, 22 September 2011

Status & tagging log