summaryrefslogtreecommitdiff
path: root/modules/g2_import
diff options
context:
space:
mode:
Diffstat (limited to 'modules/g2_import')
-rw-r--r--modules/g2_import/helpers/g2_import.php22
-rw-r--r--modules/g2_import/helpers/g2_import_task.php4
2 files changed, 23 insertions, 3 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index b2e3836a..5e2a61e8 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -1155,7 +1155,7 @@ class g2_import_Core {
"SELECT [GalleryComment::id] " .
"FROM [GalleryComment] " .
"WHERE [GalleryComment::publishStatus] = 0 " . // 0 == COMMENT_PUBLISH_STATUS_PUBLISHED
- "AND [GalleryComment::id] > ?",
+ "AND [GalleryComment::id] > ?",
array($min_id),
array("limit" => array("count" => 100))));
while ($result = $results->nextResult()) {
@@ -1184,6 +1184,26 @@ class g2_import_Core {
}
/**
+ * Get a set of user ids from Gallery 2 greater than $min_id. We use this to get the
+ * next chunk of users to import.
+ */
+ static function get_user_ids($min_id) {
+ global $gallery;
+
+ $ids = array();
+ $results = g2($gallery->search(
+ "SELECT [GalleryUser::id] " .
+ "FROM [GalleryUser] " .
+ "WHERE [GalleryUser::id] > ?",
+ array($min_id),
+ array("limit" => array("count" => 100))));
+ while ($result = $results->nextResult()) {
+ $ids[] = $result[0];
+ }
+ return $ids;
+ }
+
+ /**
* Look in our map to find the corresponding Gallery 3 id for the given Gallery 2 id.
*/
static function map($g2_id) {
diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php
index f2a13291..dbfe5f77 100644
--- a/modules/g2_import/helpers/g2_import_task.php
+++ b/modules/g2_import/helpers/g2_import_task.php
@@ -109,8 +109,8 @@ class g2_import_task_Core {
case "users":
if (empty($queue)) {
- $task->set(
- "queue", $queue = array_keys(g2(GalleryCoreApi::fetchUsersForGroup(GROUP_EVERYBODY))));
+ $task->set("queue", $queue = g2_import::get_user_ids($task->get("last_id", 0)));
+ $task->set("last_id", end($queue));
}
$log_message = g2_import::import_user($queue);
if ($log_message) {