Index: trunk/phase3/includes/Article.php |
— | — | @@ -1930,23 +1930,36 @@ |
1931 | 1931 | } |
1932 | 1932 | |
1933 | 1933 | 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 | | - |
1942 | 1934 | if( !$blanked ) { |
1943 | 1935 | if( $authorOfAll === false ) { |
1944 | | - $reason = wfMsgForContent( 'excontent', $text ); |
| 1936 | + $reason = wfMsgForContent( 'excontent', '$1' ); |
1945 | 1937 | } else { |
1946 | | - $reason = wfMsgForContent( 'excontentauthor', $text, $authorOfAll ); |
| 1938 | + $reason = wfMsgForContent( 'excontentauthor', '$1', $authorOfAll ); |
1947 | 1939 | } |
1948 | 1940 | } else { |
1949 | | - $reason = wfMsgForContent( 'exbeforeblank', $text ); |
| 1941 | + $reason = wfMsgForContent( 'exbeforeblank', '$1' ); |
1950 | 1942 | } |
| 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 ); |
1951 | 1964 | } |
1952 | 1965 | } |
1953 | 1966 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -130,6 +130,8 @@ |
131 | 131 | * Remove all commas when parsing float numbers in sorted tables |
132 | 132 | * Limit text field of deletion, protection and user rights changes reasons to |
133 | 133 | 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) |
134 | 136 | |
135 | 137 | === API changes in 1.12 === |
136 | 138 | |