Skip to content
Snippets Groups Projects
Commit 77906124 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

modified the configuration class so it allows multiple simultanous instances....

modified the configuration class so it allows multiple simultanous instances. This is important in the case where you write a separate application that makes use of simplesamlphp and also make use of the simplesamlphp libraries as the template system where the template directory is not the same as for simplesamlphp itself. I am writing an application called openwiki where this is important. should not break existing code, and no modifications neccessary in other simplesamlphp files.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@239 44740490-163a-0410-bde0-09ae8108e29a
parent f1157683
No related branches found
No related tags found
No related merge requests found
...@@ -9,24 +9,24 @@ ...@@ -9,24 +9,24 @@
*/ */
class SimpleSAML_Configuration { class SimpleSAML_Configuration {
private static $instance = null; private static $instance = array();
private $configpath = null; private $configpath = null;
private $configuration = null; private $configuration = null;
// private constructor restricts instantiaton to getInstance() // private constructor restricts instantiaton to getInstance()
private function __construct($configpath) { private function __construct($configpath) {
$this->configpath = $configpath; $this->configpath = $configpath;
} }
public static function getInstance() { public static function getInstance($instancename = 'simplesaml') {
return self::$instance; if (!array_key_exists($instancename, self::$instance))
throw new Exception('Configuration with name ' . $instancename . ' is not initialized.');
return self::$instance[$instancename];
} }
public static function init($path) { public static function init($path, $instancename = 'simplesaml') {
self::$instance = new SimpleSAML_Configuration($path); self::$instance[$instancename] = new SimpleSAML_Configuration($path);
} }
private function loadConfig() { private function loadConfig() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment