Browse Source

Fix regression in create_config()

On update some bool options might got changed values to false,
if not specified in the config.inc.php file.
pull/8962/head
Aleksander Machniak 3 years ago
parent
commit
cc1bdf6a36
  1. 2
      bin/update.sh
  2. 13
      program/include/rcmail_install.php

2
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!

13
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') {

Loading…
Cancel
Save