summaryrefslogtreecommitdiff
path: root/modules/g2_import/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r--modules/g2_import/helpers/g2_import.php21
-rw-r--r--modules/g2_import/helpers/g2_import_task.php2
2 files changed, 21 insertions, 2 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 22fb68c6..23fb29e5 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -219,7 +219,7 @@ class g2_import_Core {
* Return a set of statistics about the number of users, groups, albums, photos, movies and
* comments available for import from the Gallery 2 instance.
*/
- static function stats() {
+ static function g2_stats() {
global $gallery;
$root_album_id = g2(GalleryCoreApi::getDefaultAlbumId());
$stats["users"] = g2(GalleryCoreApi::fetchUserCount());
@@ -248,6 +248,25 @@ class g2_import_Core {
}
/**
+ * Return a set of statistics about the number of users, groups, albums, photos, movies and
+ * comments already imported into the Gallery 3 instance.
+ */
+ static function g3_stats() {
+ $g3_stats = array(
+ "album" => 0, "comment" => 0, "item" => 0, "user" => 0, "group" => 0, "tag" => 0);
+ foreach (db::build()
+ ->select("resource_type")
+ ->select(array("C" => 'COUNT("*")'))
+ ->from("g2_maps")
+ ->where("resource_type", "IN", array("album", "comment", "item", "user", "group"))
+ ->group_by("resource_type")
+ ->execute() as $row) {
+ $g3_stats[$row->resource_type] = $row->C;
+ }
+ return $g3_stats;
+ }
+
+ /**
* Import a single group.
*/
static function import_group(&$queue) {
diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php
index 6bda8f17..5e908676 100644
--- a/modules/g2_import/helpers/g2_import_task.php
+++ b/modules/g2_import/helpers/g2_import_task.php
@@ -56,7 +56,7 @@ class g2_import_task_Core {
$mode = $task->get("mode");
$queue = $task->get("queue");
if (!isset($mode)) {
- $stats = g2_import::stats();
+ $stats = g2_import::g2_stats();
$stats["items"] = $stats["photos"] + $stats["movies"];
unset($stats["photos"]);
unset($stats["movies"]);