diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-05-11 17:57:34 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-11 17:57:34 +0000 |
| commit | 74b89379633a92b538a647c89131ee3b645bfcf6 (patch) | |
| tree | 449559ba0ca91f93c87cf1ad9cac32aadadac917 /modules/g2_import/helpers/g2_import_task.php | |
| parent | 62053b2c5cc1b8e58a886b3380645fde6ecb3b6d (diff) | |
Framework for importing comments -- we don't actually do the import yet
Diffstat (limited to 'modules/g2_import/helpers/g2_import_task.php')
| -rw-r--r-- | modules/g2_import/helpers/g2_import_task.php | 14 |
1 files changed, 12 insertions, 2 deletions
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": |
