(bug 33374) - 'Deletion log summary not properly truncated'
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 8 Feb 2012 19:53:55 +0000 (19:53 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 8 Feb 2012 19:53:55 +0000 (19:53 +0000)
includes/logging/LogEntry.php

index 6fe7539..c6f717b 100644 (file)
@@ -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__ );