From 1fa782d4fdaedefc123324fc54c5015aac5faed6 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 4 Jul 2011 17:03:09 +0000 Subject: [PATCH] (bug 29109) Allow the automatic edit summary for redirect creation show the first bit of the new redirect page. Adds $2 to the autoredircomment (not used by default) that contains the first 150-ish characters of the newly created redirect page. Meant so that the Wikipedian's can see their {{R from foo}} templates. --- RELEASE-NOTES-1.19 | 2 ++ includes/WikiPage.php | 5 ++++- languages/messages/MessagesQqq.php | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index f5187469b1..e10ffc0460 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -62,6 +62,8 @@ production. statistics (maintenance/language/transstat.php) * (bug 29586) Make the (next 200) links on categories link directly to the relevant section of the category. +* (bug 29109) Allow the automatic edit summary for redirect creation + show the first bit of the new redirect page. === Bug fixes in 1.19 === * (bug 28868) Show total pages in the subtitle of an image on the diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 90cacda212..8a823cde0e 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2297,7 +2297,10 @@ class WikiPage extends Page { $rt = Title::newFromRedirect( $newtext ); if ( is_object( $rt ) && ( !is_object( $ot ) || !$rt->equals( $ot ) || $ot->getFragment() != $rt->getFragment() ) ) { - return wfMsgForContent( 'autoredircomment', $rt->getFullText() ); + $truncatedtext = $wgContLang->truncate( + str_replace( "\n", ' ', $newtext ), + max( 0, 200 - strlen( wfMsgForContent( 'autoredircomment' ) ) ) ); + return wfMsgForContent( 'autoredircomment', $rt->getFullText(), $truncatedtext ); } # New page autosummaries diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 0a3e238b51..937057ad82 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -3930,7 +3930,7 @@ Most languages use a space, but some Asian languages, such as Thai and Chinese, # Auto-summaries 'autosumm-blank' => 'The auto summary when blanking the whole page. This is not the same as deleting the page.', 'autosumm-replace' => 'The auto summary when a user removes a lot of characters in the page.', -'autoredircomment' => 'The auto summary when making a redirect. $1 is the page where it redirects to.', +'autoredircomment' => 'The auto summary when making a redirect. $1 is the page where it redirects to. $2 is the first X number of characters of the redirect ($2 is usually only used when end users customize the message)', 'autosumm-new' => 'The auto summary when creating a new page. $1 are the first X number of characters of the new page.', # Size units -- 2.20.1