Create CDB_CONFIG database. Renamed some members of CitControl.
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 7 Apr 2015 12:37:23 +0000 (08:37 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Tue, 7 Apr 2015 12:37:23 +0000 (08:37 -0400)
citadel/control.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/migrate/serv_migrate.c
citadel/modules/upgrade/serv_upgrade.c
citadel/server.h

index 2a608eee014a24a78887f6a0c9e62c593dc57208..a541cbeb0a6557d9aa893e575ad5d7609bb7f14b 100644 (file)
@@ -1,15 +1,15 @@
 /*
  * This module handles states which are global to the entire server.
  *
- * Copyright (c) 1987-2014 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 <stdio.h>
@@ -682,7 +682,7 @@ void cmd_conf(char *argbuf)
                 * index so it doesn't try to use it later.
                 */
                if (config.c_enable_fulltext == 0) {
-                       CitControl.fulltext_wordbreaker = 0;
+                       CitControl.MM_fulltext_wordbreaker = 0;
                        put_control();
                }
        }
index 6288bfc9ab99adb0a240c99b739aab54da32622e..7f5da0fe84d604863b3ba68567a1f4d73d7fd570 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This module handles fulltext indexing of the message base.
- * Copyright (c) 2005-2011 by the citadel.org team
+ * Copyright (c) 2005-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 as published
@@ -268,7 +268,7 @@ void do_fulltext_indexing(void) {
         * Check to see whether the fulltext index is up to date; if there
         * are no messages to index, don't waste any more time trying.
         */
-       if ((CitControl.MMfulltext >= CitControl.MMhighest) && (CitControl.fulltext_wordbreaker == FT_WORDBREAKER_ID)) {
+       if ((CitControl.MMfulltext >= CitControl.MMhighest) && (CitControl.MM_fulltext_wordbreaker == FT_WORDBREAKER_ID)) {
                return;         /* nothing to do! */
        }
        
@@ -280,9 +280,9 @@ void do_fulltext_indexing(void) {
         * over.
         */
        begin_critical_section(S_CONTROL);
-       if (CitControl.fulltext_wordbreaker != FT_WORDBREAKER_ID) {
+       if (CitControl.MM_fulltext_wordbreaker != FT_WORDBREAKER_ID) {
                syslog(LOG_DEBUG, "wb ver on disk = %d, code ver = %d",
-                       CitControl.fulltext_wordbreaker, FT_WORDBREAKER_ID
+                       CitControl.MM_fulltext_wordbreaker, FT_WORDBREAKER_ID
                );
                syslog(LOG_INFO, "(re)initializing full text index");
                cdb_trunc(CDB_FULLTEXT);
@@ -354,7 +354,7 @@ void do_fulltext_indexing(void) {
        ft_flush_cache();
        begin_critical_section(S_CONTROL);
        CitControl.MMfulltext = ft_newhighest;
-       CitControl.fulltext_wordbreaker = FT_WORDBREAKER_ID;
+       CitControl.MM_fulltext_wordbreaker = FT_WORDBREAKER_ID;
        put_control();
        end_critical_section(S_CONTROL);
        last_index = time(NULL);
index 97181a1c64763850523c23d60c07b99d29a87aa6..0ec223e03e93e92ff92e2b392bdad2b7d21f861d 100644 (file)
@@ -516,7 +516,7 @@ void migr_do_export(void) {
        cprintf("<control_flags>%u</control_flags>\n", CitControl.MMflags);
        cprintf("<control_nextuser>%ld</control_nextuser>\n", CitControl.MMnextuser);
        cprintf("<control_nextroom>%ld</control_nextroom>\n", CitControl.MMnextroom);
-       cprintf("<control_version>%d</control_version>\n", CitControl.version);
+       cprintf("<control_version>%d</control_version>\n", CitControl.MM_hosted_upgrade_level);
        client_write("</control>\n", 11);
        cprintf("<progress>%d</progress>\n", 2);
 
@@ -704,7 +704,7 @@ int migr_controlrecord(void *data, const char *el)
        else if (!strcasecmp(el, "control_flags"))              CitControl.MMflags = atoi(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "control_nextuser"))           CitControl.MMnextuser = atol(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "control_nextroom"))           CitControl.MMnextroom = atol(ChrPtr(migr_chardata));
-       else if (!strcasecmp(el, "control_version"))            CitControl.version = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "control_version"))            CitControl.MM_hosted_upgrade_level = atoi(ChrPtr(migr_chardata));
 
        else if (!strcasecmp(el, "control")) {
                CitControl.MMfulltext = (-1L);  /* always flush */
index 085f5f046d1ebca105e936a0ab0ef61e237cf79a..1ce073f78b911b8572e42f8de8504ec40265537c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Transparently handle the upgrading of server data formats.
  *
- * Copyright (c) 1987-2014 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.
@@ -262,36 +262,36 @@ void guess_time_zone(void) {
 void update_config(void) {
        get_config();
 
-       if (CitControl.version < 606) {
+       if (CitControl.MM_hosted_upgrade_level < 606) {
                config.c_rfc822_strict_from = 0;
        }
 
-       if (CitControl.version < 609) {
+       if (CitControl.MM_hosted_upgrade_level < 609) {
                config.c_purge_hour = 3;
        }
 
-       if (CitControl.version < 615) {
+       if (CitControl.MM_hosted_upgrade_level < 615) {
                config.c_ldap_port = 389;
        }
 
-       if (CitControl.version < 623) {
+       if (CitControl.MM_hosted_upgrade_level < 623) {
                strcpy(config.c_ip_addr, "*");
        }
 
-       if (CitControl.version < 650) {
+       if (CitControl.MM_hosted_upgrade_level < 650) {
                config.c_enable_fulltext = 1;
        }
 
-       if (CitControl.version < 652) {
+       if (CitControl.MM_hosted_upgrade_level < 652) {
                config.c_auto_cull = 1;
        }
 
-       if (CitControl.version < 725) {
+       if (CitControl.MM_hosted_upgrade_level < 725) {
                config.c_xmpp_c2s_port = 5222;
                config.c_xmpp_s2s_port = 5269;
        }
 
-       if (CitControl.version < 830) {
+       if (CitControl.MM_hosted_upgrade_level < 830) {
                config.c_nntp_port = 119;
                config.c_nntps_port = 563;
        }
@@ -313,11 +313,11 @@ void check_server_upgrades(void) {
 
        get_control();
        syslog(LOG_INFO, "Existing database version on disk is %d.%02d",
-               (CitControl.version / 100),
-               (CitControl.version % 100)
+               (CitControl.MM_hosted_upgrade_level / 100),
+               (CitControl.MM_hosted_upgrade_level % 100)
        );
 
-       if (CitControl.version < REV_LEVEL) {
+       if (CitControl.MM_hosted_upgrade_level < REV_LEVEL) {
                syslog(LOG_WARNING,
                        "Server hosted updates need to be processed at this time.  Please wait..."
                );
@@ -328,29 +328,29 @@ void check_server_upgrades(void) {
 
        update_config();
 
-       if ((CitControl.version > 000) && (CitControl.version < 555)) {
+       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 555)) {
                syslog(LOG_EMERG, "This database is too old to be upgraded.  Citadel server will exit.");
                exit(EXIT_FAILURE);
        }
-       if ((CitControl.version > 000) && (CitControl.version < 591)) {
+       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 591)) {
                bump_mailbox_generation_numbers();
        }
-       if ((CitControl.version > 000) && (CitControl.version < 608)) {
+       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 608)) {
                convert_ctdluid_to_minusone();
        }
-       if ((CitControl.version > 000) && (CitControl.version < 659)) {
+       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 659)) {
                rebuild_euid_index();
        }
-       if (CitControl.version < 735) {
+       if (CitControl.MM_hosted_upgrade_level < 735) {
                fix_sys_user_name();
        }
-       if (CitControl.version < 736) {
+       if (CitControl.MM_hosted_upgrade_level < 736) {
                rebuild_usersbynumber();
        }
-       if (CitControl.version < 790) {
+       if (CitControl.MM_hosted_upgrade_level < 790) {
                remove_thread_users();
        }
-       if (CitControl.version < 810) {
+       if (CitControl.MM_hosted_upgrade_level < 810) {
                struct ctdlroom QRoom;
                if (!CtdlGetRoom(&QRoom, SMTP_SPOOLOUT_ROOM)) {
                        QRoom.QRdefaultview = VIEW_QUEUE;
@@ -362,7 +362,7 @@ void check_server_upgrades(void) {
                }
        }
 
-       CitControl.version = REV_LEVEL;
+       CitControl.MM_hosted_upgrade_level = REV_LEVEL;
 
        /*
         * Negative values for maxsessions are not allowed.
index 6aedb546393124cce3a72d7e6259eea3740404c5..d9bcb207e4da1242574930b0b5076e5a98d135f6 100644 (file)
@@ -1,3 +1,17 @@
+/* 
+ * Main declarations file for the Citadel server
+ *
+ * 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 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.
+ */
+
 #ifndef SERVER_H
 #define SERVER_H
 
@@ -109,8 +123,8 @@ struct CitControl {
        unsigned MMflags;               /* Global system flags              */
        long MMnextuser;                /* highest user number on system    */
        long MMnextroom;                /* highest room number on system    */
-       int version;                    /* Server-hosted upgrade level      */
-       int fulltext_wordbreaker;       /* ID of wordbreaker in use         */
+       int MM_hosted_upgrade_level;    /* Server-hosted upgrade level      */
+       int MM_fulltext_wordbreaker;    /* ID of wordbreaker in use         */
        long MMfulltext;                /* highest message number indexed   */
        int MMdbversion;                /* Version of Berkeley DB used on previous server run */
 };
@@ -210,6 +224,7 @@ enum {
        CDB_EUIDINDEX,          /* locate msgs by EUID           */
        CDB_USERSBYNUMBER,      /* index of users by number      */
        CDB_OPENID,             /* associates OpenIDs with users */
+       CDB_CONFIG,             /* global system configuration   */
        MAXCDB                  /* total number of CDB's defined */
 };