From 74b89379633a92b538a647c89131ee3b645bfcf6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 11 May 2009 17:57:34 +0000 Subject: Framework for importing comments -- we don't actually do the import yet --- modules/g2_import/helpers/g2_import_task.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'modules/g2_import/helpers/g2_import_task.php') diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index 8fd8f72b..32d39da4 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -58,11 +58,16 @@ class g2_import_task_Core { } } - $modes = array("groups", "users", "albums", "photos", "comments", "done"); + $modes = array("groups", "users", "albums", "photos"); + if (g2_import::g2_module_active("comment") && module::is_installed("comment")) { + $modes[] = "comments"; + } + $modes[] = "done"; while (!$task->done && microtime(true) - $start < 1.5) { if ($i >= ($stats[$modes[$mode]] - 1)) { $i = 0; $mode++; + $task->set("last_id", 0); $queue = array(); } @@ -91,7 +96,6 @@ class g2_import_task_Core { $task->set("queue", $queue = g2(GalleryCoreApi::fetchAlbumTree())); } g2_import::import_album($queue); - $task->set("queue", $queue); $task->status = t( "Importing albums %count / %total", array("count" => $i, "total" => $stats["albums"])); break; @@ -108,8 +112,14 @@ class g2_import_task_Core { break; case "comments": + if (empty($queue)) { + $task->set("queue", $queue = g2_import::get_comment_ids($task->get("last_id", 0))); + $task->set("last_id", end($queue)); + } + g2_import::import_comment($queue); $task->status = t("Importing comments %count / %total", array("count" => $i, "total" => $stats["comments"])); + break; case "done": -- cgit v1.2.3