started setting up new config system
authorArt Cancro <ajc@uncensored.citadel.org>
Fri, 24 Apr 2015 22:35:57 +0000 (18:35 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Fri, 24 Apr 2015 22:35:57 +0000 (18:35 -0400)
citadel/citserver.c
citadel/config.c
citadel/config.h
citadel/modules/upgrade/serv_upgrade.c

index 0ba31244673aede1d1af89dca0b4de503157842d..076f5cee9ba0b7010f04d7c918260036dddde6c3 100644 (file)
@@ -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");
index 2c376f467119512cad928b31285ce82b2a0a804e..4a6f49e4a0834fb081c80a91806a565a04765740 100644 (file)
@@ -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;
 }
index eb61711cc44339b857addc0dbafabeab54f200bf..3b7f4c531b197f147a143e732b24b2f1c355bfb3 100644 (file)
@@ -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);
index 1ce073f78b911b8572e42f8de8504ec40265537c..fc8c1d58e7f1769f3d45b4d5354a33aa77fe784d 100644 (file)
@@ -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;