X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCommentStore.php;h=b8a31e6f02ffe98b51541bdeda0060e0a52df2ef;hb=75a3043b71e96dff59f3559eba62dd2c6e5b86b6;hp=2ed21d199554f68dd1ffdd89c938ef21da845275;hpb=c66360d167aeacec8ec296ae8ff29fd5d3f1a557;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/CommentStore.php b/includes/CommentStore.php index 2ed21d1995..b8a31e6f02 100644 --- a/includes/CommentStore.php +++ b/includes/CommentStore.php @@ -367,26 +367,7 @@ class CommentStore { * @return CommentStoreComment */ public function createComment( IDatabase $dbw, $comment, array $data = null ) { - global $wgContLang; - - if ( !$comment instanceof CommentStoreComment ) { - if ( $data !== null ) { - foreach ( $data as $k => $v ) { - if ( substr( $k, 0, 1 ) === '_' ) { - throw new InvalidArgumentException( 'Keys in $data beginning with "_" are reserved' ); - } - } - } - if ( $comment instanceof Message ) { - $message = clone $comment; - $text = $message->inLanguage( $wgContLang ) // Avoid $wgForceUIMsgAsContentMsg - ->setInterfaceMessageFlag( true ) - ->text(); - $comment = new CommentStoreComment( null, $text, $message, $data ); - } else { - $comment = new CommentStoreComment( null, $comment, null, $data ); - } - } + $comment = CommentStoreComment::newUnsavedComment( $comment, $data ); # Truncate comment in a Unicode-sensitive manner $comment->text = $this->lang->truncate( $comment->text, self::MAX_COMMENT_LENGTH );