From: Timo Sirainen Date: Sun, 2 Mar 2025 09:39:08 +0000 (+0200) Subject: doveconf: Write how many default setting changes there have been since configured... X-Git-Tag: 2.4.1~110 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=13e69c54a593f09fdcf1b827b3b1d52371f87711;p=thirdparty%2Fdovecot%2Fcore.git doveconf: Write how many default setting changes there have been since configured dovecot_config_version --- diff --git a/src/config/doveconf.c b/src/config/doveconf.c index 6925cd2ec3..161a206d3f 100644 --- a/src/config/doveconf.c +++ b/src/config/doveconf.c @@ -1239,8 +1239,14 @@ int main(int argc, char *argv[]) if (*info != '\0') printf("# %s\n", info); printf("# Hostname: %s\n", my_hostdomain()); - if (config_parsed_get_version(config, &version)) + if (config_parsed_get_version(config, &version)) { + unsigned int count = old_settings_default_changes_count(version); + if (count > 0) { + printf("# %u default setting changes since version %s\n", + count, version); + } printf("dovecot_config_version = %s\n", version); + } if (!config_path_specified) check_wrong_config(config_path); if (scope == CONFIG_DUMP_SCOPE_ALL_WITHOUT_HIDDEN) diff --git a/src/config/old-set-parser.c b/src/config/old-set-parser.c index 0d2255d20a..4ae8506dc7 100644 --- a/src/config/old-set-parser.c +++ b/src/config/old-set-parser.c @@ -93,3 +93,18 @@ bool old_settings_default(const char *dovecot_config_version, } return FALSE; } + +unsigned int +old_settings_default_changes_count(const char *dovecot_config_version) +{ + struct settings_history *history = settings_history_get(); + const struct setting_history_default *def; + unsigned int count = 0; + + array_foreach(&history->defaults, def) { + if (version_cmp(def->version, dovecot_config_version) <= 0) + break; + count++; + } + return count; +} diff --git a/src/config/old-set-parser.h b/src/config/old-set-parser.h index baeb80ef01..d286f054ff 100644 --- a/src/config/old-set-parser.h +++ b/src/config/old-set-parser.h @@ -10,5 +10,7 @@ void old_settings_handle(struct config_parser_context *ctx, bool old_settings_default(const char *dovecot_config_version, const char *key, const char *key_with_path, const char **old_default_r); +unsigned int +old_settings_default_changes_count(const char *dovecot_config_version); #endif