Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96546


Change subject: Truncate protect reason for whole multibyte characters
......................................................................

Truncate protect reason for whole multibyte characters

This avoids broken characters for long comment.
The reason is shown on action=edit for unprivilieged users.

Change-Id: Ie8099f50628d55ff880760721169803ccbb3555c
---
M includes/WikiPage.php
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/46/96546/1

diff --git a/includes/WikiPage.php b/includes/WikiPage.php
index 6c2c6ad..7b68510 100644
--- a/includes/WikiPage.php
+++ b/includes/WikiPage.php
@@ -2247,7 +2247,7 @@
         * @return Status
         */
        public function doUpdateRestrictions( array $limit, array $expiry, 
&$cascade, $reason, User $user ) {
-               global $wgCascadingRestrictionLevels;
+               global $wgCascadingRestrictionLevels, $wgContLang;
 
                if ( wfReadOnly() ) {
                        return Status::newFatal( 'readonlytext', 
wfReadOnlyReason() );
@@ -2319,6 +2319,9 @@
                        $revCommentMsg = 'protectedarticle';
                        $logAction = 'protect';
                }
+
+               // Truncate for whole multibyte characters
+               $reason = $wgContLang->truncate( $reason, 255 );
 
                if ( $id ) { // Protection of existing page
                        if ( !wfRunHooks( 'ArticleProtect', array( &$this, 
&$user, $limit, $reason ) ) ) {
@@ -2421,7 +2424,7 @@
 
                // Update the protection log
                $log = new LogPage( 'protect' );
-               $log->addEntry( $logAction, $this->mTitle, trim( $reason ), 
$params, $user );
+               $log->addEntry( $logAction, $this->mTitle, $reason, $params, 
$user );
 
                return Status::newGood();
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/96546
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8099f50628d55ff880760721169803ccbb3555c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to