summaryrefslogtreecommitdiff
path: root/modules/g2_import/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-08-08 16:50:02 -0700
committerBharat Mediratta <bharat@menalto.com>2010-08-08 16:50:02 -0700
commitcdb6306d7e75451587fbc029b94ef197f42842f1 (patch)
tree74a8c1a8bdc1757647ab79cf0385a72366ead854 /modules/g2_import/helpers
parent8da37d595cc81e3c340dd98fdb621b6955a3ad3f (diff)
Backdate the created/updated dates for imported comments. Fixes ticket #1215.
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r--modules/g2_import/helpers/g2_import.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 4817ec04..8db10dc1 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -859,7 +859,6 @@ class g2_import_Core {
$comment->text = self::_transform_bbcode($text);
$comment->state = "published";
$comment->server_http_host = $g2_comment->getHost();
- $comment->created = $g2_comment->getDate();
try {
$comment->save();
} catch (Exception $e) {
@@ -868,6 +867,14 @@ class g2_import_Core {
array("id" => $g2_comment_id)),
$e);
}
+
+ // Backdate the creation date. We can't do this at creation time because
+ // Comment_Model::save() will override it.
+ db::update("comments")
+ ->set("created", $g2_comment->getDate())
+ ->set("updated", $g2_comment->getDate())
+ ->where("id", "=", $comment->id)
+ ->execute();
}
/**