diff --git a/Model/Import/Wordpress.php b/Model/Import/Wordpress.php index c2ba3abe..62f38f3e 100644 --- a/Model/Import/Wordpress.php +++ b/Model/Import/Wordpress.php @@ -47,6 +47,7 @@ public function execute() while ($data = mysqli_fetch_assoc($result)) { /* Prepare category data */ foreach (['title', 'identifier'] as $key) { + /*$data[$key] = utf8_encode($data[$key]);*/ $data[$key] = mb_convert_encoding($data[$key], 'HTML-ENTITIES', 'UTF-8'); } @@ -122,6 +123,7 @@ public function execute() while ($data = mysqli_fetch_assoc($result)) { /* Prepare tag data */ foreach (['title', 'identifier'] as $key) { + /*$data[$key] = utf8_encode($data[$key]);*/ $data[$key] = mb_convert_encoding($data[$key], 'HTML-ENTITIES', 'UTF-8'); } @@ -215,6 +217,7 @@ public function execute() /* Prepare post data */ foreach (['post_title', 'post_name', 'post_content'] as $key) { + /*$data[$key] = utf8_encode($data[$key]);*/ $data[$key] = mb_convert_encoding($data[$key], 'HTML-ENTITIES', 'UTF-8'); } @@ -259,10 +262,8 @@ public function execute() $commentParents = []; while ($comments = mysqli_fetch_assoc($resultComments)) { - $commentParentId = 0; if (!($comments['comment_parent'] == 0)) $commentParentId = $commentParents[$comments["comment_parent"]]; - $commentData = [ 'parent_id' => $commentParentId, 'post_id' => $post->getPostId(), @@ -274,13 +275,17 @@ public function execute() 'creation_time' => $comments['comment_date'], ]; + if (!$commentData['text']) { + continue; + } + $comment = $this->_commentFactory->create($commentData); try { /* Initial saving */ $comment->setData($commentData)->save(); $commentParents[$comments["comment_ID"]] = $comment->getCommentId(); - } catch (\Magento\Framework\Exception\LocalizedException $e) { + } catch (\Exception $e) { unset($comment); } }