Merge "Handle comment truncation in CommentStore"
[lhc/web/wiklou.git] / includes / changes / RecentChange.php
index 588f602..1992223 100644 (file)
@@ -284,7 +284,7 @@ class RecentChange {
         * @param bool $noudp
         */
        public function save( $noudp = false ) {
-               global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
+               global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker;
 
                $dbw = wfGetDB( DB_MASTER );
                if ( !is_array( $this->mExtra ) ) {
@@ -315,12 +315,8 @@ class RecentChange {
                # Trim spaces on user supplied text
                $this->mAttribs['rc_comment'] = trim( $this->mAttribs['rc_comment'] );
 
-               # Make sure summary is truncated (whole multibyte characters)
-               $this->mAttribs['rc_comment'] = $wgContLang->truncate( $this->mAttribs['rc_comment'], 255 );
-
                # Fixup database timestamps
                $this->mAttribs['rc_timestamp'] = $dbw->timestamp( $this->mAttribs['rc_timestamp'] );
-               $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'recentchanges_rc_id_seq' );
 
                # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
                if ( $this->mAttribs['rc_cur_id'] == 0 ) {
@@ -333,6 +329,10 @@ class RecentChange {
                unset( $row['rc_comment'], $row['rc_comment_text'], $row['rc_comment_data'] );
                $row += CommentStore::newKey( 'rc_comment' )->insert( $dbw, $comment );
 
+               # Don't reuse an existing rc_id for the new row, if one happens to be
+               # set for some reason.
+               unset( $row['rc_id'] );
+
                # Insert new row
                $dbw->insert( 'recentchanges', $row, __METHOD__ );