From 656c339879a071f2f875831281ed833b876e4361 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Mon, 20 Jun 2011 10:48:45 +0000 Subject: removed useless calls to empty contructor; reverted some additional undocumented changes; upported the "cgi workaround" to trunk/; large (fake) changeset are due to mixed cr/crlf used previously --- framework/Util/TParameterModule.php | 58 +++++++++++++++---------------------- framework/Util/TRpcClient.php | 1 - 2 files changed, 23 insertions(+), 36 deletions(-) (limited to 'framework/Util') diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index 265bdd38..0109ca32 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Util @@ -24,7 +24,6 @@ * * * - * * * * @@ -34,19 +33,12 @@ * * * - * * * * - * Setting the final attribute to true will cause that parameter to be unchangable - * by any future mergeParameters. - * * If a parameter is defined both in the external file and within the module * tag, the former takes precedence. * - * the application parameters are processed first before the modules parameters - * are processed. - * * @author Qiang Xue * @author Carl G. Mathisen * @version $Id$ @@ -101,7 +93,7 @@ class TParameterModule extends TModule /** * Loads parameters into application. - * @param mixed XML or PHP representation of the parameters + * @param mixed XML of PHP representation of the parameters * @throws TConfigurationException if the parameter file format is invalid */ protected function loadParameters($config) @@ -111,23 +103,10 @@ class TParameterModule extends TModule { foreach($config as $id => $parameter) { - if(is_array($parameter)) + if(is_array($parameter) && isset($parameter['class'])) { - $final = TPropertyValue::ensureBoolean($parameter['final']); - unset($parameter['final']); - if(isset($parameter['class'])) - { - $properties = isset($parameter['properties']) ? $parameter['properties'] : array(); - $properties['id'] = $id; - $parameters[$id] = array('type'=>0, 'class' => $parameter['class'], 'properties' => $properties, - 'final' => $final, 'value' => $parameter); - } else { - if(!isset($parameter['value'])) { - $parameters[$id]=array('type'=>1, 'value' => $parameter, 'final' => $final); - } else { - $parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final); - } - } + $properties = isset($parameter['properties'])?$parameter['properties']:array(); + $parameters[$id]=array($parameter['class'],$properties); } else { @@ -142,22 +121,31 @@ class TParameterModule extends TModule $properties=$node->getAttributes(); if(($id=$properties->remove('id'))===null) throw new TConfigurationException('parametermodule_parameterid_required'); - $final = TPropertyValue::ensureBoolean($properties->remove('final')); if(($type=$properties->remove('class'))===null) { if(($value=$properties->remove('value'))===null) - $parameters[$id]=array('type'=>1, 'value' => $node, 'final' => $final); + $parameters[$id]=$node; else - $parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final); - } - else { - $parameters[$id]=array('type'=>0, 'class' => $type, 'properties' => $properties->toArray(), - 'final' => $final, 'value' => $node); + $parameters[$id]=$value; } + else + $parameters[$id]=array($type,$properties->toArray()); + } + } + + $appParams=$this->getApplication()->getParameters(); + foreach($parameters as $id=>$parameter) + { + if(is_array($parameter)) + { + $component=Prado::createComponent($parameter[0]); + foreach($parameter[1] as $name=>$value) + $component->setSubProperty($name,$value); + $appParams->add($id,$component); } + else + $appParams->add($id,$parameter); } - - $this->getApplication()->mergeParameters($parameters); } /** diff --git a/framework/Util/TRpcClient.php b/framework/Util/TRpcClient.php index dbda931e..fbfb528a 100644 --- a/framework/Util/TRpcClient.php +++ b/framework/Util/TRpcClient.php @@ -66,7 +66,6 @@ class TRpcClient extends TApplicationComponent */ public function __construct($serverUrl, $isNotification = false) { - parent::__construct(); $this->_serverUrl = $serverUrl; $this->_isNotification = TPropertyValue::ensureBoolean($isNotification); } -- cgit v1.2.3