extension config vars are only save to settings.xml if a value is set

previously even empty values has been saved, they just needed to be
defined in the extension configuration. This may break extensions which
do not check if a config var is set.
This commit is contained in:
Uwe Steinmann 2019-10-23 09:08:53 +02:00
parent 75f3afdc84
commit 38f2759c5f

View File

@ -1039,12 +1039,27 @@ class Settings { /* {{{ */
{
// search XML node
$extnode = $extnodes->addChild('extension');
$this->setXMLAttributValue($extnode, 'name', $name);
$this->setXMLAttributValue($extnode, 'name', $name);
/* New code saves all parameters of the extension which have been set
* in configuration form.
*/
foreach($extension as $fieldname=>$confvalue) {
if($confvalue) {
$parameter = $extnode->addChild('parameter');
$parameter[0] = isset($extension[$fieldname]) ? (is_array($extension[$fieldname]) ? implode(',', $extension[$fieldname]) : $extension[$fieldname]) : '';
$this->setXMLAttributValue($parameter, 'name', $fieldname);
}
}
/* Old code saves those parameters listed in the configuration
* of the extension.
*/
/*
foreach($GLOBALS['EXT_CONF'][$name]['config'] as $fieldname=>$conf) {
$parameter = $extnode->addChild('parameter');
$parameter[0] = isset($extension[$fieldname]) ? (is_array($extension[$fieldname]) ? implode(',', $extension[$fieldname]) : $extension[$fieldname]) : '';
$this->setXMLAttributValue($parameter, 'name', $fieldname);
}
*/
} // foreach