diff options
author | Bharat Mediratta <bharat@menalto.com> | 2012-05-07 11:55:23 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2012-05-07 12:04:43 -0700 |
commit | a23fed4ce1331ebd15530a66b51933eec8edb6a8 (patch) | |
tree | dd28fbbf71b9da5ff05d8baab73a4f675fd25566 | |
parent | c44ae2a6b8efd8dcccd467d054599333a2caabfe (diff) |
Improve IdentityProvider switching code, patch thanks to Reklov
Nesalk. Fixes #1834.
-rw-r--r-- | modules/gallery/libraries/IdentityProvider.php | 9 |
1 files changed, 9 insertions, 0 deletions
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); |