diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-04-22 16:30:37 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-04-22 16:30:37 -0700 |
commit | 5040adebb5c4e1e491fbb6c3b98783f5809020a3 (patch) | |
tree | dc63f868c841a2bf4ed58e20d483eb9981217ba6 /modules/g2_import/helpers | |
parent | 526859d9605d137ebe053ecbd80f46ca6a331194 (diff) |
Totally revamp the G2 Import UI to make it sexxxy. Fixes #1683.
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 21 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_task.php | 2 |
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"]); |