diff options
author | Aleksander Machniak <alec@alec.pl> | 2022-11-13 16:11:52 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2022-11-13 16:13:43 +0300 |
commit | cc1bdf6a362f56a54ee3690640434e96b95a0c44 (patch) | |
tree | 8bf39320709f4e9aaf2fccc6e23e299fbb8bd196 | |
parent | 624400d7fa77ac40e96a58eedfcad76b750daef7 (diff) |
Fix regression in create_config()release-1.6
On update some bool options might got changed values to false,
if not specified in the config.inc.php file.
-rwxr-xr-x | bin/update.sh | 2 | ||||
-rw-r--r-- | program/include/rcmail_install.php | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/bin/update.sh b/bin/update.sh index c46ad4bf6..81c1fc36a 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -101,7 +101,7 @@ if ($RCI->configured) { if (!$error) { $RCI->merge_config(); echo ". writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n"; - $written = $RCI->save_configfile($RCI->create_config()); + $written = $RCI->save_configfile($RCI->create_config(false)); } // Success! diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index 6932af225..9bf4013c6 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -206,16 +206,23 @@ class rcmail_install * Create configuration file that contains parameters * that differ from default values. * + * @param bool $use_post Use POSTed configuration values (of supported options) + * * @return string The complete config file content */ - public function create_config() + public function create_config($use_post = true) { $config = []; foreach ($this->config as $prop => $default) { $post_value = $_POST["_$prop"] ?? null; - $is_default = $post_value === null || !in_array($prop, $this->supported_config); - $value = !$is_default || in_array($prop, $this->bool_config_props) ? $post_value : $default; + $value = $default; + + if ($use_post && in_array($prop, $this->supported_config) + && ($post_value !== null || in_array($prop, $this->bool_config_props)) + ) { + $value = $post_value; + } // always disable installer if ($prop == 'enable_installer') { |