From dc3ed06cd76ebc7b949865be789fb26590d63ed0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 14 Jun 2009 12:43:06 -0700 Subject: Trap gallery2 errors when we try to load an invalid user id and abort loading that user. --- modules/g2_import/helpers/g2_import.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/g2_import/helpers/g2_import.php') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 19d02f25..f385907d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -259,7 +259,14 @@ class g2_import_Core { $g2_admin_group_id = g2(GalleryCoreApi::getPluginParameter("module", "core", "id.adminGroup")); - $g2_user = g2(GalleryCoreApi::loadEntitiesById($g2_user_id)); + try { + $g2_user = g2(GalleryCoreApi::loadEntitiesById($g2_user_id)); + } catch (Exception $e) { + $msg = t("Failed to import Gallery 2 user with id: %id", array("id" => $g2_user_id)); + Kohana::log("alert", $msg); + message::warning($msg); + return; + } $g2_groups = g2(GalleryCoreApi::fetchGroupsForUser($g2_user->getId())); try { -- cgit v1.2.3