From: Art Cancro Date: Tue, 7 Apr 2015 12:37:23 +0000 (-0400) Subject: Create CDB_CONFIG database. Renamed some members of CitControl. X-Git-Tag: Release_902~167^2~43 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=a46e719c5c6252c1342acb5f2d5ac96f8778759a Create CDB_CONFIG database. Renamed some members of CitControl. --- diff --git a/citadel/control.c b/citadel/control.c index 2a608eee0..a541cbeb0 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -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 @@ -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(); } } diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index 6288bfc9a..7f5da0fe8 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -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); diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index 97181a1c6..0ec223e03 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -516,7 +516,7 @@ void migr_do_export(void) { cprintf("%u\n", CitControl.MMflags); cprintf("%ld\n", CitControl.MMnextuser); cprintf("%ld\n", CitControl.MMnextroom); - cprintf("%d\n", CitControl.version); + cprintf("%d\n", CitControl.MM_hosted_upgrade_level); client_write("\n", 11); cprintf("%d\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 */ diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 085f5f046..1ce073f78 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -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. diff --git a/citadel/server.h b/citadel/server.h index 6aedb5463..d9bcb207e 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -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 */ };