diff options
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index c79a8d36..5c690da4 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -908,9 +908,14 @@ class g2_import_Core { array("id" => $g2_comment_id, "exception" => (string)$e)); } - if (self::map($g2_comment->getId())) { - // Already imported - return; + if ($id = self::map($g2_comment->getId())) { + if (ORM::factory("comment", $id)->loaded()) { + // Already imported and still exists + return; + } + // This comment was already imported, but now it no longer exists. Import it again, per + // ticket #1736. + self::clear_map($g2_comment_id); } $item_id = self::map($g2_comment->getParentId()); @@ -948,10 +953,11 @@ class g2_import_Core { self::set_map($g2_comment->getId(), $comment->id, "comment"); // Backdate the creation date. We can't do this at creation time because - // Comment_Model::save() will override it. + // Comment_Model::save() will override it. Leave the updated date alone + // so that if the comments get marked as spam, they don't immediately get + // flushed (see ticket #1736) db::update("comments") ->set("created", $g2_comment->getDate()) - ->set("updated", $g2_comment->getDate()) ->where("id", "=", $comment->id) ->execute(); } @@ -1306,6 +1312,16 @@ class g2_import_Core { self::$map[$g2_id] = $g3_id; } + /** + * Remove all map entries associated with the given Gallery 2 id. + */ + static function clear_map($g2_id) { + db::build() + ->delete("g2_maps") + ->where("g2_id", "=", $g2_id) + ->execute(); + } + static function log($msg) { message::warning($msg); Kohana_Log::add("alert", $msg); |