From 4cfb6ca506e465b2d403502eeeb56e73c2b6fde2 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 24 Apr 2015 18:35:57 -0400 Subject: [PATCH] started setting up new config system --- citadel/citserver.c | 5 +++- citadel/config.c | 32 ++++++++++++++++++++++++-- citadel/config.h | 18 +++++++-------- citadel/modules/upgrade/serv_upgrade.c | 1 - 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/citadel/citserver.c b/citadel/citserver.c index 0ba312446..076f5cee9 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -139,7 +139,7 @@ void master_startup(void) { /* Load site-specific configuration */ syslog(LOG_INFO, "Loading citadel.config"); - get_config(); + initialize_config_system(); validate_config(); syslog(LOG_INFO, "Acquiring control record"); @@ -209,6 +209,9 @@ void master_cleanup(int exitcode) { /* Do system-dependent stuff */ sysdep_master_cleanup(); + + /* Close the configuration system */ + shutdown_config_system(); /* Close databases */ syslog(LOG_INFO, "Closing databases\n"); diff --git a/citadel/config.c b/citadel/config.c index 2c376f467..4a6f49e4a 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -19,7 +19,8 @@ #include "config.h" #include "ctdl_module.h" -struct config config; +struct config config; // legacy configuration +HashList *ctdlconfig = NULL; // new configuration #define STR_NOT_EMPTY(CFG_FIELDNAME) if (IsEmptyStr(config.CFG_FIELDNAME)) \ syslog(LOG_EMERG, "configuration setting "#CFG_FIELDNAME" is empty, but must not - check your config!"); @@ -123,7 +124,7 @@ void brand_new_installation_set_defaults(void) { * Called during the initialization of Citadel server. * It verifies the system's integrity and reads citadel.config into memory. */ -void get_config(void) { +void initialize_config_system(void) { FILE *cfp; int rv; @@ -240,6 +241,33 @@ void put_config(void) +/* + * Called when Citadel server is shutting down. + * Clears out the config hash table. + */ +void shutdown_config_system(void) +{ + DeleteHash(&ctdlconfig); +} + + + + + + + + +/**********************************************************************/ + + + + + + + + + + void CtdlGetSysConfigBackend(long msgnum, void *userdata) { config_msgnum = msgnum; } diff --git a/citadel/config.h b/citadel/config.h index eb61711cc..3b7f4c531 100644 --- a/citadel/config.h +++ b/citadel/config.h @@ -1,20 +1,20 @@ /* - * Copyright (c) 1987-2012 by the citadel.org team + * Copyright (c) 1987-2015 by the citadel.org team * - * This program is open source software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3. + * This program is open source software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ #include "serv_extensions.h" #include "citadel_dirs.h" - -void get_config(void); +void initialize_config_system(void); +void shutdown_config_system(void); void put_config(void); char *CtdlGetSysConfig(char *sysconfname); diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 1ce073f78..fc8c1d58e 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -260,7 +260,6 @@ void guess_time_zone(void) { * Note that if the previous version was 0 then this is a new installation running for the first time. */ void update_config(void) { - get_config(); if (CitControl.MM_hosted_upgrade_level < 606) { config.c_rfc822_strict_from = 0; -- 2.30.2