r27170 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27169‎ | r27170 | r27171 >
Date:16:20, 4 November 2007
Author:rotem
Status:old
Tags:
Comment:
In the deletion default reasons, calculate how much text to get from the article text, rather than getting 150 characters (which may be too much), and remove possible unfinished links
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -1930,23 +1930,36 @@
19311931 }
19321932
19331933 if( $reason === '' ) {
1934 - # comment field=255, let's grep the first 150 to have some user
1935 - # space left
1936 - global $wgContLang;
1937 - $text = $wgContLang->truncate( $text, 150, '...' );
1938 -
1939 - # let's strip out newlines
1940 - $text = preg_replace( "/[\n\r]/", '', $text );
1941 -
19421934 if( !$blanked ) {
19431935 if( $authorOfAll === false ) {
1944 - $reason = wfMsgForContent( 'excontent', $text );
 1936+ $reason = wfMsgForContent( 'excontent', '$1' );
19451937 } else {
1946 - $reason = wfMsgForContent( 'excontentauthor', $text, $authorOfAll );
 1938+ $reason = wfMsgForContent( 'excontentauthor', '$1', $authorOfAll );
19471939 }
19481940 } else {
1949 - $reason = wfMsgForContent( 'exbeforeblank', $text );
 1941+ $reason = wfMsgForContent( 'exbeforeblank', '$1' );
19501942 }
 1943+
 1944+ # comment field=255, find the max length of the content from page
 1945+ # Max content length is max comment length, minus length of the actual
 1946+ # comment (except for the $1), and minus the possible ... chars
 1947+ $maxLength = 255 - ( strlen( $reason ) - 2 ) - 3;
 1948+ if( $maxLength < 0 ) {
 1949+ $maxLength = 0;
 1950+ }
 1951+
 1952+ # let's strip out newlines
 1953+ $text = preg_replace( "/[\n\r]/", '', $text );
 1954+
 1955+ # Truncate to max length
 1956+ global $wgContLang;
 1957+ $text = $wgContLang->truncate( $text, $maxLength, '...' );
 1958+
 1959+ # Remove possible unfinished links
 1960+ $text = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $text );
 1961+
 1962+ # Add to the reason field
 1963+ $reason = str_replace( '$1', $text, $reason );
19511964 }
19521965 }
19531966
Index: trunk/phase3/RELEASE-NOTES
@@ -130,6 +130,8 @@
131131 * Remove all commas when parsing float numbers in sorted tables
132132 * Limit text field of deletion, protection and user rights changes reasons to
133133 255 characters (already restricted in the database)
 134+* In the deletion default reasons, calculate how much text to get from the
 135+ article text, rather than getting 150 characters (which may be too much)
134136
135137 === API changes in 1.12 ===
136138

Status & tagging log