From a23fed4ce1331ebd15530a66b51933eec8edb6a8 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 7 May 2012 11:55:23 -0700 Subject: Improve IdentityProvider switching code, patch thanks to Reklov Nesalk. Fixes #1834. --- modules/gallery/libraries/IdentityProvider.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index 66c68dad..c9e8688f 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -85,6 +85,10 @@ class IdentityProvider_Core { call_user_func("{$new_provider}_installer::initialize"); } + if (!$provider->admin_user()) { + throw new Exception("IdentityProvider $new_provider: Couldn't find the admin user!"); + } + module::event("identity_provider_changed", $current_provider, $new_provider); identity::set_active_user($provider->admin_user()); @@ -100,7 +104,12 @@ class IdentityProvider_Core { // Make sure new provider is not in the database try { module::uninstall($new_provider); + } catch (Exception $e2) { + Kohana_Log::add("error", "Error uninstalling failed new provider\n" . + $e2->getMessage() . "\n" . $e2->getTraceAsString()); + } + try { // Lets reset to the current provider so that the gallery installation is still // working. module::set_var("gallery", "identity_provider", null); -- cgit v1.2.3