Change Identity adminstration to use the uninstall/install methods when changing providers.

This commit is contained in:
Tim Almdal
2009-10-22 22:29:56 -07:00
parent 89ca1590e4
commit b74b131e25
10 changed files with 114 additions and 170 deletions

View File

@@ -38,7 +38,7 @@ class IdentityProvider_Core {
* @return Identity_Core
*/
static function & instance() {
if (!isset(self::$instance)) {
if (empty(self::$instance)) {
// Create a new instance
self::$instance = new IdentityProvider();
}
@@ -47,14 +47,14 @@ class IdentityProvider_Core {
}
/**
* Returns a singleton instance of Identity.
* There can only be one Identity driver configured at a given point
* Frees the current instance of the identity provider so the next call to instance will reload
*
* @param string configuration
* @return Identity_Core
*/
static function reset() {
self::$instance = new IdentityProvider();
self::$instance = null;
Kohana::config_clear("identity");
}
/**
@@ -66,12 +66,12 @@ class IdentityProvider_Core {
$config = module::get_var("gallery", "identity_provider", "user");
// Test the config group name
if (($this->config = Kohana::config("identity.".$config)) === NULL) {
if (($this->config = Kohana::config("identity." . $config)) === NULL) {
throw new Exception("@todo NO USER LIBRARY CONFIGURATION FOR: $config");
}
// Set driver name
$driver = "IdentityProvider_".ucfirst($this->config["driver"])."_Driver";
$driver = "IdentityProvider_" . ucfirst($this->config["driver"]) ."_Driver";
// Load the driver
if ( ! Kohana::auto_load($driver)) {
@@ -100,20 +100,6 @@ class IdentityProvider_Core {
return !empty($this->config["allow_updates"]);
}
/**
* @see IdentityProvider_Driver::activate.
*/
public function activate() {
$this->driver->activate();
}
/**
* @see IdentityProvider_Driver::deactivate.
*/
public function deactivate() {
$this->driver->deactivate();
}
/**
* @see IdentityProvider_Driver::guest.
*/