summaryrefslogtreecommitdiff
path: root/modules/g2_import/helpers/g2_import.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/g2_import/helpers/g2_import.php')
-rw-r--r--modules/g2_import/helpers/g2_import.php51
1 files changed, 49 insertions, 2 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 8de5ce44..162aa67b 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -499,6 +499,9 @@ class g2_import_Core {
static function set_album_highlight(&$queue) {
// Dequeue the current album and enqueue its children
list($g2_album_id, $children) = each($queue);
+ if (empty($children)) {
+ return;
+ }
unset($queue[$g2_album_id]);
foreach ($children as $key => $value) {
$queue[$key] = $value;
@@ -1152,7 +1155,8 @@ class g2_import_Core {
"SELECT [GalleryComment::id] " .
"FROM [GalleryComment] " .
"WHERE [GalleryComment::publishStatus] = 0 " . // 0 == COMMENT_PUBLISH_STATUS_PUBLISHED
- "AND [GalleryComment::id] > ?",
+ "AND [GalleryComment::id] > ? " .
+ "ORDER BY [GalleryComment::id] ASC",
array($min_id),
array("limit" => array("count" => 100))));
while ($result = $results->nextResult()) {
@@ -1171,7 +1175,50 @@ class g2_import_Core {
$ids = array();
$results = g2($gallery->search(
"SELECT DISTINCT([TagItemMap::itemId]) FROM [TagItemMap] " .
- "WHERE [TagItemMap::itemId] > ?",
+ "WHERE [TagItemMap::itemId] > ? " .
+ "ORDER BY [TagItemMap::itemId] ASC",
+ array($min_id),
+ array("limit" => array("count" => 100))));
+ while ($result = $results->nextResult()) {
+ $ids[] = $result[0];
+ }
+ return $ids;
+ }
+
+ /**
+ * 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] > ? " .
+ "ORDER BY [GalleryUser::id] ASC",
+ array($min_id),
+ array("limit" => array("count" => 100))));
+ while ($result = $results->nextResult()) {
+ $ids[] = $result[0];
+ }
+ return $ids;
+ }
+
+ /**
+ * Get a set of group ids from Gallery 2 greater than $min_id. We use this to get the
+ * next chunk of groups to import.
+ */
+ static function get_group_ids($min_id) {
+ global $gallery;
+
+ $ids = array();
+ $results = g2($gallery->search(
+ "SELECT [GalleryGroup::id] " .
+ "FROM [GalleryGroup] " .
+ "WHERE [GalleryGroup::id] > ? " .
+ "ORDER BY [GalleryGroup::id] ASC",
array($min_id),
array("limit" => array("count" => 100))));
while ($result = $results->nextResult()) {