r91414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91413‎ | r91414 | r91415 >
Date:17:03, 4 July 2011
Author:bawolff
Status:resolved (Comments)
Tags:
Comment:
(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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -62,6 +62,8 @@
6363 statistics (maintenance/language/transstat.php)
6464 * (bug 29586) Make the (next 200) links on categories link directly to
6565 the relevant section of the category.
 66+* (bug 29109) Allow the automatic edit summary for redirect creation
 67+ show the first bit of the new redirect page.
6668
6769 === Bug fixes in 1.19 ===
6870 * (bug 28868) Show total pages in the subtitle of an image on the
Index: trunk/phase3/includes/WikiPage.php
@@ -2297,7 +2297,10 @@
22982298 $rt = Title::newFromRedirect( $newtext );
22992299
23002300 if ( is_object( $rt ) && ( !is_object( $ot ) || !$rt->equals( $ot ) || $ot->getFragment() != $rt->getFragment() ) ) {
2301 - return wfMsgForContent( 'autoredircomment', $rt->getFullText() );
 2301+ $truncatedtext = $wgContLang->truncate(
 2302+ str_replace( "\n", ' ', $newtext ),
 2303+ max( 0, 200 - strlen( wfMsgForContent( 'autoredircomment' ) ) ) );
 2304+ return wfMsgForContent( 'autoredircomment', $rt->getFullText(), $truncatedtext );
23022305 }
23032306
23042307 # New page autosummaries
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -3930,7 +3930,7 @@
39313931 # Auto-summaries
39323932 'autosumm-blank' => 'The auto summary when blanking the whole page. This is not the same as deleting the page.',
39333933 'autosumm-replace' => 'The auto summary when a user removes a lot of characters in the page.',
3934 -'autoredircomment' => 'The auto summary when making a redirect. $1 is the page where it redirects to.',
 3934+'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)',
39353935 'autosumm-new' => 'The auto summary when creating a new page. $1 are the first X number of characters of the new page.',
39363936
39373937 # Size units

Follow-up revisions

RevisionCommit summaryAuthorDate
r91508(Follow-up r91414) Also take the page name in account when considering how mu...bawolff00:24, 6 July 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   16:37, 5 July 2011

To get the proper truncation length you'd need to include the redirect target already replaced in the comment, then see what's left out of 255 chars.

Status & tagging log