r112918 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112917‎ | r112918 | r112919 >
Date:20:58, 2 March 2012
Author:bsitu
Status:ok (Comments)
Tags:todo 
Comment:
fix for bug34781 - display old title text if the namespace has been changed
Modified paths:
  • /trunk/phase3/includes/specials/SpecialNewpages.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialNewpages.php
@@ -356,7 +356,14 @@
357357
358358 $css = count( $classes ) ? ' class="' . implode( ' ', $classes ) . '"' : '';
359359
360 - return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay}</li>\n";
 360+ # Display the old title if the namespace has been changed
 361+ $oldTitleText = '';
 362+ if ( $result->page_namespace !== $result->rc_namespace ) {
 363+ $oldTitleText = wfMessage( 'rc-old-title' )->params( Title::makeTitle( $result->rc_namespace, $result->rc_title )
 364+ ->getPrefixedText() )->escaped();
 365+ }
 366+
 367+ return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";
361368 }
362369
363370 /**
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -1789,6 +1789,7 @@
17901790 Does not work under $wgMiserMode ([[mwr:48986|r48986]]).',
17911791 'rc-change-size-new' => 'Tooltip when hovering a change list diff size. The tooltip shows the resulting new size in bytes.',
17921792 'newsectionsummary' => 'Default summary when adding a new section to a page.',
 1793+'rc-old-title' => 'Text that shows the original title of a page, $1 is the original title text',
17931794
17941795 # Recent changes linked
17951796 'recentchangeslinked' => 'Title of [[Special:RecentChangesLinked]] and display name of page on [[Special:SpecialPages]].',
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2073,6 +2073,7 @@
20742074 'newsectionsummary' => '/* $1 */ new section',
20752075 'rc-enhanced-expand' => 'Show details (requires JavaScript)',
20762076 'rc-enhanced-hide' => 'Hide details',
 2077+'rc-old-title' => 'originally created as "$1"',
20772078
20782079 # Recent changes linked
20792080 'recentchangeslinked' => 'Related changes',

Follow-up revisions

RevisionCommit summaryAuthorDate
r112956r112918: Add new message key to maintenance fileraymond18:39, 3 March 2012
r113307followup to -r112918 - display old title in SpecialNews page when namespace o...bsitu21:45, 7 March 2012
r113935MFT r112918, r113214, r113394, r113415, r113617, r113710, r113727, r113737, r...reedy17:27, 15 March 2012
r114015MFT r112918, r113214, r113268, r113277, r113312, r113415, r113454, r113737, r...reedy15:18, 16 March 2012

Comments

#Comment by Catrope (talk | contribs)   20:15, 7 March 2012

This is OK, but I would prefer to always to this if the two titles are different, not just if their namespaces are different. With this, if a page is moved within the same namespace, the "originally created as" text isn't shown.

You could accomplish this with something like:

$oldTitle = Title::makeTitle( $row->rc_namespace, $row->rc_title );
if ( !$title->equals( $oldTitle ) ) {
...
}

Status & tagging log