diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-05-11 20:16:54 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-11 20:16:54 +0000 |
commit | a70cbed1d01ddfc56038720a3e7c1d81a4b9dc14 (patch) | |
tree | 967330dbd7398d13f5413eba2b6ac3dc5adc09ca | |
parent | de812e1e8225f49deec27063d96a81ce4431ebcc (diff) |
Import comments. This was a lot easier than I thought it would be
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index ee3dd61e..3ba37c86 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -306,6 +306,25 @@ class g2_import_Core { static function import_comment(&$queue) { $g2_comment_id = array_shift($queue); $g2_comment = g2(GalleryCoreApi::loadEntitiesById($g2_comment_id)); + + $text = $g2_comment->getSubject(); + if ($text) { + $text .= " "; + } + $text .= $g2_comment->getComment(); + + // Just import the fields we know about. Do this outside of the comment API for now so that + // 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->text = $text; + $comment->state = "published"; + $comment->server_http_host = $g2_comment->getHost(); + $comment->save(); + + self::map($g2_comment->getId(), $comment->id); } /** |