Skip to content
Snippets Groups Projects
Commit c3220301 authored by Olav Morken's avatar Olav Morken
Browse files

Configuration: Allow the same configuration to be loaded multiple times.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@674 44740490-163a-0410-bde0-09ae8108e29a
parent 200b7048
No related branches found
No related tags found
No related merge requests found
...@@ -33,10 +33,20 @@ class SimpleSAML_Configuration { ...@@ -33,10 +33,20 @@ class SimpleSAML_Configuration {
} }
public static function init($path, $instancename = 'simplesaml', $configfilename = 'config.php') { public static function init($path, $instancename = 'simplesaml', $configfilename = 'config.php') {
/* Check if we already have loaded the given config - return the existing instance if we have. */
if(array_key_exists($instancename, self::$instance)) {
return self::$instance[$instancename];
}
self::$instance[$instancename] = new SimpleSAML_Configuration($path, $configfilename); self::$instance[$instancename] = new SimpleSAML_Configuration($path, $configfilename);
} }
public function copyFromBase($instancename, $filename) { public function copyFromBase($instancename, $filename) {
/* Check if we already have loaded the given config - return the existing instance if we have. */
if(array_key_exists($instancename, self::$instance)) {
return self::$instance[$instancename];
}
self::$instance[$instancename] = new SimpleSAML_Configuration($this->configpath, $filename); self::$instance[$instancename] = new SimpleSAML_Configuration($this->configpath, $filename);
return self::$instance[$instancename]; return self::$instance[$instancename];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment