From 294683b3901c6dc1bf55040fcdc10d1679dd567f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 12 Nov 2019 20:30:42 +0100 Subject: [PATCH] Fix so update.sh script warns about changed defaults (#7011) --- CHANGELOG | 1 + bin/update.sh | 15 ++++++++++----- program/include/rcmail_install.php | 20 +++++++++++++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7f008feed..aa571ba78 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ CHANGELOG Roundcube Webmail - Fix invalid Signature button state after escaping Mailvelope mode (#7015) - Fix so 401 error is returned only on failed logon requests (#7010) - Fix db_prefix handling in queries with `TRUNCATE TABLE ` and `UNIQUE ` (#7013) +- Fix so update.sh script warns about changed defaults (#7011) RELEASE 1.4.0 ------------- diff --git a/bin/update.sh b/bin/update.sh index 0a3b201af..f9f8b4c27 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -43,7 +43,7 @@ $RCI->load_config(); if ($RCI->configured) { $success = true; - if (($messages = $RCI->check_config()) || $RCI->legacy_config) { + if (($messages = $RCI->check_config($opts['version'])) || $RCI->legacy_config) { $success = false; $err = 0; @@ -56,8 +56,6 @@ if ($RCI->configured) { echo "- '" . $msg['prop'] . "' was replaced by '" . $msg['replacement'] . "'\n"; $err++; } - - echo "\n"; } // list obsolete config options (just a notice) @@ -70,8 +68,6 @@ if ($RCI->configured) { echo "- '" . $msg['prop'] . ($msg['name'] ? "': " . $msg['name'] : "'") . "\n"; $err++; } - - echo "\n"; } if (!$err && $RCI->legacy_config) { @@ -137,6 +133,15 @@ if ($RCI->configured) { } } + // list of config options with changed default (just a notice) + if (!empty($messages['defaults'])) { + echo "WARNING: Changed defaults (These config options have new default values):\n"; + + foreach ($messages['defaults'] as $opt) { + echo "- '{$opt}'\n"; + } + } + // check dependencies based on the current configuration if (is_array($messages['dependencies'])) { echo "WARNING: Dependency check failed!\n"; diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index 3166b90a5..9eae0770d 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -61,6 +61,10 @@ class rcmail_install 'Oracle' => 'oci8', ); + /** @var array List of config options with default value change per-release */ + public $defaults_changes = array( + '1.4.0' => array('skin', 'smtp_port', 'smto_user', 'smtp_pass'), + ); /** * Constructor @@ -298,9 +302,11 @@ class rcmail_install * Check the current configuration for missing properties * and deprecated or obsolete settings * + * @param string $version Previous version on upgrade + * * @return array List with problems detected */ - public function check_config() + public function check_config($version = null) { $this->load_config(); @@ -379,6 +385,18 @@ class rcmail_install } } + if ($version) { + $out['defaults'] = array(); + + foreach ($this->defaults_changes as $v => $opts) { + if (version_compare($v, $version, '>')) { + $out['defaults'] = array_merge($out['defaults'], $opts); + } + } + + $out['defaults'] = array_unique($out['defaults']); + } + return $out; }