summaryrefslogtreecommitdiff
path: root/framework/Util/TParameterModule.php
diff options
context:
space:
mode:
authorcarlgmathisen <>2008-12-26 23:43:51 +0000
committercarlgmathisen <>2008-12-26 23:43:51 +0000
commit7f0c873c5edebcec7bc1d27fe482f2c4395ee5cf (patch)
treeeb2fa32302119930769cbda008616a90eff2c2fe /framework/Util/TParameterModule.php
parentbd209f749d3e220d8445137939fd21d292e1d8e4 (diff)
fixed the caching bug
Diffstat (limited to 'framework/Util/TParameterModule.php')
-rw-r--r--framework/Util/TParameterModule.php24
1 files changed, 9 insertions, 15 deletions
diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php
index 7bc03e3b..5549ff71 100644
--- a/framework/Util/TParameterModule.php
+++ b/framework/Util/TParameterModule.php
@@ -46,16 +46,13 @@
*/
class TParameterModule extends TModule
{
- /**
- * @deprecated since 3.2
- */
const PARAM_FILE_EXT='.xml';
private $_initialized=false;
private $_paramFile=null;
/**
* Initializes the module by loading parameters.
- * @param mixed content enclosed within the module tag
+ * @param TXmlElement content enclosed within the module tag
*/
public function init($config)
{
@@ -63,25 +60,22 @@ class TParameterModule extends TModule
if($this->_paramFile!==null)
{
$configFile = null;
- if(($cache=$this->getApplication()->getCache())!==null)
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_XML && ($cache=$this->getApplication()->getCache())!==null)
{
$cacheKey='TParameterModule:'.$this->_paramFile;
if(($dom=$cache->get($cacheKey))===false)
{
- if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
- $configFile = include $this->_paramFile;
- else
- {
- $configFile=new TXmlDocument;
- $configFile->loadFromFile($this->_paramFile);
- }
- $cache->set($cacheKey,$configFile,0,new TFileCacheDependency($this->_paramFile));
+ $dom=new TXmlDocument;
+ $dom->loadFromFile($this->_paramFile);
+ $cache->set($cacheKey,$dom,0,new TFileCacheDependency($this->_paramFile));
}
}
else
{
if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
+ {
$configFile = include $this->_paramFile;
+ }
else
{
$configFile=new TXmlDocument;
@@ -95,7 +89,7 @@ class TParameterModule extends TModule
/**
* Loads parameters into application.
- * @param mixed XML or PHP representation of the parameters
+ * @param TXmlElement XML representation of the parameters
* @throws TConfigurationException if the parameter file format is invalid
*/
protected function loadParameters($config)
@@ -134,7 +128,7 @@ class TParameterModule extends TModule
$parameters[$id]=array($type,$properties->toArray());
}
}
-
+
$appParams=$this->getApplication()->getParameters();
foreach($parameters as $id=>$parameter)
{