From 7660fe1dd7bf3c1da0c34bc9deee162aa0286a08 Mon Sep 17 00:00:00 2001 From: GeoffreyT2000 Date: Mon, 7 Aug 2017 08:05:13 -0700 Subject: [PATCH] Make Special:NewPages show "originally created as" correctly $ret should not be generated until after $oldTitleText is generated. Then "originally created as" will be correctly shown, as expected. Bug: T171138 Change-Id: Ibcf9f36a46cfc4beb0aaa424e35a334ed73a1c98 --- includes/specials/SpecialNewpages.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 83482f6f2f..f644189e98 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -382,12 +382,6 @@ class SpecialNewpages extends IncludableSpecialPage { # Display the old title if the namespace/title has been changed $oldTitleText = ''; $oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title ); - $ret = "{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} " - . "{$tagDisplay} {$oldTitleText}"; - - // Let extensions add data - Hooks::run( 'NewPagesLineEnding', [ $this, &$ret, $result, &$classes, &$attribs ] ); - $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] ); if ( count( $classes ) ) { $attribs['class'] = implode( ' ', $classes ); @@ -402,6 +396,13 @@ class SpecialNewpages extends IncludableSpecialPage { ); } + $ret = "{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} " + . "{$tagDisplay} {$oldTitleText}"; + + // Let extensions add data + Hooks::run( 'NewPagesLineEnding', [ $this, &$ret, $result, &$classes, &$attribs ] ); + $attribs = wfArrayFilterByKey( $attribs, [ Sanitizer::class, 'isReservedDataAttribute' ] ); + return Html::rawElement( 'li', $attribs, $ret ) . "\n"; } -- 2.20.1