diff options
author | Andy Staudacher <andy.st@gmail.com> | 2010-02-09 01:51:04 -0800 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2010-02-09 01:51:04 -0800 |
commit | 55d1ce7fb7c3872295c1e7dbab41de94dd7e06d8 (patch) | |
tree | c15b9149ef98ae190678d13dc262114391787e59 /modules/g2_import/helpers | |
parent | 42bc1279257268e2c68b5f4b06e62e95ca8228d4 (diff) |
More g2_import model validation fixes, and make import less noisy (don't copy each comment text to the import log).
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 3b0f966a..80feb7d0 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -732,6 +732,12 @@ class g2_import_Core { array("id" => $g2_comment_id, "exception" => (string)$e)); } + $item_id = self::map($g2_comment->getParentId()); + if (empty($item_id)) { + // Item was not mapped. + return; + } + $text = $g2_comment->getSubject(); if ($text) { $text .= " "; @@ -742,18 +748,17 @@ class g2_import_Core { // we don't trigger spam filtering events $comment = ORM::factory("comment"); $comment->author_id = self::map($g2_comment->getCommenterId()); - $comment->guest_name = $g2_comment->getAuthor(); - $comment->item_id = self::map($g2_comment->getParentId()); + $comment->guest_name = ""; + if ($comment->author_id == identity::guest()->id) { + $comment->guest_name = $g2_comment->getAuthor(); + $comment->guest_name or $comment->guest_name = (string) t("Anonymous coward"); + } + $comment->item_id = $item_id; $comment->text = self::_transform_bbcode($text); $comment->state = "published"; $comment->server_http_host = $g2_comment->getHost(); $comment->created = $g2_comment->getDate(); $comment->save(); - - self::map($g2_comment->getId(), $comment->id); - return t("Imported comment '%comment' for item with id: %id", - array("id" => $comment->item_id, - "comment" => text::limit_words(nl2br(html::purify($comment->text)), 50))); } /** |