summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r--modules/gallery/libraries/Identity.php37
-rw-r--r--modules/gallery/libraries/drivers/Identity.php10
2 files changed, 41 insertions, 6 deletions
diff --git a/modules/gallery/libraries/Identity.php b/modules/gallery/libraries/Identity.php
index e77fd2d2..3fcb6756 100644
--- a/modules/gallery/libraries/Identity.php
+++ b/modules/gallery/libraries/Identity.php
@@ -39,13 +39,24 @@ class Identity_Core {
* @param string configuration
* @return Identity_Core
*/
- static function & instance($config="default") {
- if (!isset(Identity::$instance)) {
+ static function & instance() {
+ if (!isset(self::$instance)) {
// Create a new instance
- Identity::$instance = new Identity($config);
+ self::$instance = new Identity();
}
- return Identity::$instance;
+ return self::$instance;
+ }
+
+ /**
+ * Returns a singleton instance of Identity.
+ * There can only be one Identity driver configured at a given point
+ *
+ * @param string configuration
+ * @return Identity_Core
+ */
+ static function reset() {
+ self::$instance = new Identity();
}
/**
@@ -83,11 +94,11 @@ class Identity_Core {
}
/**
- * Return a list of installed and activated Identity Drivers.
+ * Return a list of installed Identity Drivers.
*
* @return boolean true if the driver supports updates; false if read only
*/
- static function active() {
+ static function providers() {
if (empty(self::$active)) {
$drivers = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
foreach (module::active() as $module) {
@@ -103,6 +114,20 @@ class Identity_Core {
}
/**
+ * @see Identity_Driver::activate.
+ */
+ static function activate() {
+ self::instance()->driver->activate();
+ }
+
+ /**
+ * @see Identity_Driver::deactivate.
+ */
+ static function deactivate() {
+ self::instance()->driver->deactivate();
+ }
+
+ /**
* Determine if if the current driver supports updates.
*
* @return boolean true if the driver supports updates; false if read only
diff --git a/modules/gallery/libraries/drivers/Identity.php b/modules/gallery/libraries/drivers/Identity.php
index 6ab001cb..2fc4d349 100644
--- a/modules/gallery/libraries/drivers/Identity.php
+++ b/modules/gallery/libraries/drivers/Identity.php
@@ -19,6 +19,16 @@
*/
interface Identity_Driver {
/**
+ * Initialize the provider so it is ready to use
+ */
+ public function activate();
+
+ /**
+ * Cleanup up this provider so it is unavailable for use and won't conflict with the current driver
+ */
+ public function deactivate();
+
+ /**
* Return the guest user.
*
* @return User_Definition the user object