From 93ca8e991d246362744bab7ee71aa3bf7fba6660 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 12 May 2009 22:34:59 +0000 Subject: Gracefully handle duplicate groups. Fixes ticket #280 --- modules/g2_import/helpers/g2_import.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/g2_import/helpers') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 7eb7724f..00fa6f47 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -141,7 +141,13 @@ class g2_import_Core { $g2_group = g2(GalleryCoreApi::loadEntitiesById($g2_group_id)); switch ($g2_group->getGroupType()) { case GROUP_NORMAL: - $group = group::create($g2_group->getGroupName()); + try { + $group = group::create($g2_group->getGroupName()); + } catch (Exception $e) { + // @todo For now we assume this is a "duplicate group" exception + $group = group::lookup_by_name($g2_group->getGroupname()); + } + break; case GROUP_ALL_USERS: -- cgit v1.2.3