From 44da49558172b5d639a14a35ff0fa95a7d979140 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 8 Feb 2012 19:53:55 +0000 Subject: [PATCH] (bug 33374) - 'Deletion log summary not properly truncated' --- includes/logging/LogEntry.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 6fe7539d99..c6f717b4e4 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -410,6 +410,8 @@ class ManualLogEntry extends LogEntryBase { * @return int If of the log entry */ public function insert() { + global $wgContLang; + $dbw = wfGetDB( DB_MASTER ); $id = $dbw->nextSequenceValue( 'logging_log_id_seq' ); @@ -417,6 +419,9 @@ class ManualLogEntry extends LogEntryBase { $this->timestamp = wfTimestampNow(); } + # Truncate for whole multibyte characters. + $comment = $wgContLang->truncate( $this->getComment(), 255 ); + $data = array( 'log_id' => $id, 'log_type' => $this->getType(), @@ -427,7 +432,7 @@ class ManualLogEntry extends LogEntryBase { 'log_namespace' => $this->getTarget()->getNamespace(), 'log_title' => $this->getTarget()->getDBkey(), 'log_page' => $this->getTarget()->getArticleId(), - 'log_comment' => $this->getComment(), + 'log_comment' => $comment, 'log_params' => serialize( (array) $this->getParameters() ), ); $dbw->insert( 'logging', $data, __METHOD__ ); -- 2.20.1