From a16288e7ea3e8f129d93abcc928bd7ce2d0d469c Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 13 Jul 2012 20:07:34 +0200 Subject: [PATCH] Increase length of edit summary by 5 bytes Language::truncate subtracts the length of ellipses from the whole length since 1.18, that means, there is no need for a buffer for the ellipses. Change-Id: I5c39a6c4160f16156c8928dd954f065f9e3c7a5c --- includes/EditPage.php | 8 ++++---- includes/WikiPage.php | 2 +- resources/mediawiki.action/mediawiki.action.edit.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 5ce703ef34..f03415310b 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -591,8 +591,8 @@ class EditPage { wfProfileOut( get_class( $this ) . "::importContentFormData" ); } - # Truncate for whole multibyte characters. +5 bytes for ellipsis - $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 250 ); + # Truncate for whole multibyte characters + $this->summary = $wgLang->truncate( $request->getText( 'wpSummary' ), 255 ); # If the summary consists of a heading, e.g. '==Foobar==', extract the title from the # header syntax, e.g. 'Foobar'. This is mainly an issue when we are using wpSummary for @@ -604,7 +604,7 @@ class EditPage { # currently doing double duty as both edit summary and section title. Right now this # is just to allow API edits to work around this limitation, but this should be # incorporated into the actual edit form when EditPage is rewritten (Bugs 18654, 26312). - $this->sectiontitle = $wgLang->truncate( $request->getText( 'wpSectionTitle' ), 250 ); + $this->sectiontitle = $wgLang->truncate( $request->getText( 'wpSectionTitle' ), 255 ); $this->sectiontitle = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->sectiontitle ); $this->edittime = $request->getVal( 'wpEdittime' ); @@ -2109,7 +2109,7 @@ class EditPage { * @return array An array in the format array( $label, $input ) */ function getSummaryInput( $summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null ) { - // Note: the maxlength is overriden in JS to 250 and to make it use UTF-8 bytes, not characters. + // Note: the maxlength is overriden in JS to 255 and to make it use UTF-8 bytes, not characters. $inputAttrs = ( is_array( $inputAttrs ) ? $inputAttrs : array() ) + array( 'id' => 'wpSummary', 'maxlength' => '200', diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8995f3f767..6d9170a776 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2606,7 +2606,7 @@ class WikiPage extends Page { if ( is_object( $rt ) && ( !is_object( $ot ) || !$rt->equals( $ot ) || $ot->getFragment() != $rt->getFragment() ) ) { $truncatedtext = $wgContLang->truncate( str_replace( "\n", ' ', $newtext ), - max( 0, 250 + max( 0, 255 - strlen( wfMsgForContent( 'autoredircomment' ) ) - strlen( $rt->getFullText() ) ) ); diff --git a/resources/mediawiki.action/mediawiki.action.edit.js b/resources/mediawiki.action/mediawiki.action.edit.js index e685ca948d..14b845d9d5 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.js +++ b/resources/mediawiki.action/mediawiki.action.edit.js @@ -92,7 +92,7 @@ isReady = true; // Make sure edit summary does not exceed byte limit - $( '#wpSummary' ).byteLimit( 250 ); + $( '#wpSummary' ).byteLimit( 255 ); /** * Restore the edit box scroll state following a preview operation, -- 2.20.1