From db59506010cbc46fdfbad225c6a3813e0698c908 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 3 Nov 2010 13:23:56 +0000
Subject: [PATCH] SimpleSAML_Store: Add support for defining datastores in
 modules.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2619 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Store.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/Store.php b/lib/SimpleSAML/Store.php
index 134833fdf..9447c44e5 100644
--- a/lib/SimpleSAML/Store.php
+++ b/lib/SimpleSAML/Store.php
@@ -48,7 +48,12 @@ abstract class SimpleSAML_Store {
 			self::$instance = new SimpleSAML_Store_SQL();
 			break;
 		default:
-			throw new SimpleSAML_Error_Exception('Unknown datastore type: ' . var_export($storeType, TRUE));
+			if (strpos($storeType, ':') === FALSE) {
+				throw new SimpleSAML_Error_Exception('Unknown datastore type: ' . var_export($storeType, TRUE));
+			}
+			/* Datastore from module. */
+			$className = SimpleSAML_Module::resolveClass($storeType, 'Store', 'SimpleSAML_Store');
+			self::$instance = new $className();
 		}
 
 		return self::$instance;
-- 
GitLab