+# Regenerate configuration files - almost verbatim from plc.init
+reload ()
+{
+ force=$1
+
+ # Regenerate the main configuration file from default values
+ # overlaid with site-specific and current values.
+ # Thierry -- 2007-07-05 : values in plc_config.xml are *not* taken into account here
+ files=(
+ /etc/sfa/default_config.xml
+ /etc/sfa/configs/site.xml
+ )
+ for file in "${files[@]}" ; do
+ if [ -n "$force" -o $file -nt /etc/sfa/sfa_config.xml ] ; then
+ tmp=$(mktemp /tmp/sfa_config.xml.XXXXXX)
+ plc-config --xml "${files[@]}" >$tmp
+ if [ $? -eq 0 ] ; then
+ mv $tmp /etc/sfa/sfa_config.xml
+ chmod 444 /etc/sfa/sfa_config.xml
+ else
+ echo "SFA: Warning: Invalid configuration file(s) detected"
+ rm -f $tmp
+ fi
+ break
+ fi
+ done
+
+ # Convert configuration to various formats
+ if [ -n "$force" -o /etc/sfa/sfa_config.xml -nt /etc/sfa/sfa_config ] ; then
+ plc-config --shell /etc/sfa/sfa_config.xml >/etc/sfa/sfa_config
+ fi
+ if [ -n "$force" -o /etc/sfa/sfa_config.xml -nt /etc/sfa/sfa_config.py ] ; then
+ plc-config --python /etc/sfa/sfa_config.xml >/etc/sfa/sfa_config.py
+ fi
+# if [ -n "$force" -o /etc/sfa/sfa_config.xml -nt /etc/sfa/php/sfa_config.php ] ; then
+# mkdir -p /etc/sfa/php
+# plc-config --php /etc/sfa/sfa_config.xml >/etc/sfa/php/sfa_config.php
+# fi
+
+ # [re]generate the sfa_component_config
+ gen-sfa-cm-config.py
+}