Browse Source

Fix bug where installto.sh/update.sh scripts were removing some essential options from the config file (#9051)

Plus small code improvements
pull/9518/head
Aleksander Machniak 2 years ago
parent
commit
3e303234d5
  1. 4
      CHANGELOG.md
  2. 4
      bin/update.sh
  3. 14
      program/include/rcmail_install.php
  4. 22
      tests/Rcmail/Install.php

4
CHANGELOG.md

@ -2,6 +2,10 @@
## Unreleased
- Fix bug where installto.sh/update.sh scripts were removing some essential options from the config file (#9051)
## Release 1.6.2
- Add Uyghur localization
- Fix regression in OAuth request URI caused by use of REQUEST_URI instead of SCRIPT_NAME as a default (#8878)
- Fix bug where false attachment reminder was displayed on HTML mail with inline images (#8885)

4
bin/update.sh

@ -88,7 +88,7 @@ if ($RCI->configured) {
if (!empty($opts['accept']) || strtolower($input) == 'y') {
$error = $written = false;
echo ". backing up the current config file(s)...\n";
echo "- backing up the current config file(s)...\n";
foreach (['config', 'main', 'db'] as $file) {
if (file_exists(RCMAIL_CONFIG_DIR . '/' . $file . '.inc.php')) {
@ -100,7 +100,7 @@ if ($RCI->configured) {
if (!$error) {
$RCI->merge_config();
echo ". writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n";
echo "- writing " . RCMAIL_CONFIG_DIR . "/config.inc.php...\n";
$written = $RCI->save_configfile($RCI->create_config(false));
}

14
program/include/rcmail_install.php

@ -439,10 +439,10 @@ class rcmail_install
else {
$this->config[$replacement] = $current[$prop];
}
}
unset($current[$prop]);
unset($current[$replacement]);
unset($current[$prop]);
unset($current[$replacement]);
}
}
// Merge old *_port options into the new *_host options, where possible
@ -464,9 +464,9 @@ class rcmail_install
}
// add all ldap_public sources having global_search enabled to autocomplete_addressbooks
if (is_array($current['ldap_public'])) {
if (!empty($current['ldap_public']) && is_array($current['ldap_public'])) {
foreach ($current['ldap_public'] as $key => $ldap_public) {
if ($ldap_public['global_search']) {
if (!empty($ldap_public['global_search'])) {
$this->config['autocomplete_addressbooks'][] = $key;
unset($current['ldap_public'][$key]['global_search']);
}
@ -474,10 +474,6 @@ class rcmail_install
}
$this->config = array_merge($this->config, $current);
foreach (array_keys((array) $current['ldap_public']) as $key) {
$this->config['ldap_public'][$key] = $current['ldap_public'][$key];
}
}
/**

22
tests/Rcmail/Install.php

@ -116,4 +116,26 @@ class Rcmail_RcmailInstall extends ActionTestCase
$this->assertSame($acl, $result[0]);
}
/**
* Test merge_config() method
*/
function test_merge_config()
{
$config = [
'imap_host' => 'ssl://test:993',
'smtp_host' => 'ssl://test:465',
];
$install = rcmail_install::get_instance();
$install->configured = true;
$install->config = $config;
$install->merge_config();
$this->assertSame($config['imap_host'], $install->config['imap_host']);
$this->assertSame($config['smtp_host'], $install->config['smtp_host']);
$this->markTestIncomplete(); // TODO: More tests
}
}
Loading…
Cancel
Save