diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/controllers/admin_g2_import.php | 5 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 26 |
2 files changed, 26 insertions, 5 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index 1a705bea..4c8af852 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -60,6 +60,11 @@ class Admin_g2_import_Controller extends Admin_Controller { array("url" => url::site("admin/modules"), "module_id" => $module_id))); } } + if (module::is_active("akismet")) { + message::warning( + t("The Akismet module may mark some or all of your imported comments as spam. <a href=\"%url\">Deactivate</a> it to avoid that outcome.", + array("url" => url::site("admin/modules")))); + } } else if (g2_import::is_configured()) { $view->content->form->configure_g2_import->embed_path->add_error("invalid", 1); } 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); |