summaryrefslogtreecommitdiff
path: root/modules/g2_import
diff options
context:
space:
mode:
authorChad Parry <github@chad.parry.org>2011-06-25 14:13:25 -0600
committerChad Parry <github@chad.parry.org>2011-06-25 14:13:25 -0600
commit521a682837ab5b035d63160ea7b22540f3adf7b1 (patch)
tree2b7a7af221f92c6c470234731bbb05cb81ee07e7 /modules/g2_import
parent20d7bfd6b904053c2bc27b69d32c71a321e0dae9 (diff)
parent771de0a3746ac0d780cb5dce2a14aa5a6ddf06d7 (diff)
Merge branch 'master' into rawphoto-squash
Diffstat (limited to 'modules/g2_import')
-rw-r--r--modules/g2_import/controllers/admin_g2_import.php5
-rw-r--r--modules/g2_import/helpers/g2_import.php27
2 files changed, 27 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..8a5d2c5f 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -908,9 +908,13 @@ 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.
}
$item_id = self::map($g2_comment->getParentId());
@@ -948,10 +952,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();
}
@@ -1292,6 +1297,7 @@ class g2_import_Core {
* Associate a Gallery 2 id with a Gallery 3 item id.
*/
static function set_map($g2_id, $g3_id, $resource_type, $g2_url=null) {
+ self::clear_map($g2_id, $resource_type);
$g2_map = ORM::factory("g2_map");
$g2_map->g3_id = $g3_id;
$g2_map->g2_id = $g2_id;
@@ -1306,6 +1312,17 @@ 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, $resource_type) {
+ db::build()
+ ->delete("g2_maps")
+ ->where("g2_id", "=", $g2_id)
+ ->where("resource_type", "=", $resource_type)
+ ->execute();
+ }
+
static function log($msg) {
message::warning($msg);
Kohana_Log::add("alert", $msg);