From f20fa2cfedc42f98a38a77d77186d180bd0c3426 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 17 Jan 2010 20:37:25 -0800 Subject: Change IdentityProvider::create_user() to take $email as well, since that's a required parameter for the Gallery driver. --- modules/gallery/libraries/IdentityProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/gallery/libraries/IdentityProvider.php') diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index bcb3056a..30d4efa4 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -119,8 +119,8 @@ class IdentityProvider_Core { /** * @see IdentityProvider_Driver::create_user. */ - public function create_user($name, $full_name, $password) { - return $this->driver->create_user($name, $full_name, $password); + public function create_user($name, $full_name, $password, $email) { + return $this->driver->create_user($name, $full_name, $password, $email); } /** -- cgit v1.2.3 From 804614711ab79a739539fa0052e527d8c2152a90 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 25 Jan 2010 19:49:52 -0800 Subject: Make only one attempt to restore the old identity provider in case of failure. Else, we can get into an infinite recursion. --- modules/gallery/libraries/IdentityProvider.php | 34 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'modules/gallery/libraries/IdentityProvider.php') diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index 79151154..c6b393ec 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -86,18 +86,28 @@ class IdentityProvider_Core { auth::login($provider->admin_user()); Session::instance()->regenerate(); } catch (Exception $e) { - // Make sure new provider is not in the database - module::uninstall($new_provider); - - // Lets reset to the current provider so that the gallery installation is still - // working. - module::set_var("gallery", "identity_provider", null); - IdentityProvider::change_provider($current_provider); - module::activate($current_provider); - message::error( - t("Error attempting to enable \"%new_provider\" identity provider, " . - "reverted to \"%old_provider\" identity provider", - array("new_provider" => $new_provider, "old_provider" => $current_provider))); + static $restore_already_running; + + // In case of error, make an attempt to restore the old provider. Since that's calling into + // this function again and can fail, we should be sure not to get into an infinite recursion. + if (!$restore_already_running) { + $restore_already_running = true; + + // Make sure new provider is not in the database + module::uninstall($new_provider); + + // Lets reset to the current provider so that the gallery installation is still + // working. + module::set_var("gallery", "identity_provider", null); + IdentityProvider::change_provider($current_provider); + module::activate($current_provider); + message::error( + t("Error attempting to enable \"%new_provider\" identity provider, " . + "reverted to \"%old_provider\" identity provider", + array("new_provider" => $new_provider, "old_provider" => $current_provider))); + + $restore_already_running = false; + } throw $e; } } -- cgit v1.2.3 From 9908f37eef22db81061eef7783d4d7fd11ccaf3b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 28 Jan 2010 21:33:41 -0800 Subject: Use identity::set_active_user() instead of auth::login() when we change providers otherwise the user_installer code is going to be calling auth::login() which causes all kinds of unexpected weirdness, like it triggers the handler in gallery_event which detects graphics toolkits, and that's only supposed to run on the first admin login. --- modules/gallery/libraries/IdentityProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/libraries/IdentityProvider.php') diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index c6b393ec..3f1666eb 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -83,7 +83,7 @@ class IdentityProvider_Core { module::event("identity_provider_changed", $current_provider, $new_provider); - auth::login($provider->admin_user()); + identity::set_active_user($provider->admin_user()); Session::instance()->regenerate(); } catch (Exception $e) { static $restore_already_running; -- cgit v1.2.3