From 6ce3233cf1b33473e8171c4543cc0dc245e779a8 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 30 Jul 2003 00:26:51 +0000 Subject: [PATCH] * Removed the "weekly" script and began installing a facility to allow database maintenance to happen automatically. (One Step Install can't require the sysadmin to know cron) --- citadel/ChangeLog | 6 ++ citadel/Makefile.in | 9 +-- citadel/citadel.h | 7 ++- citadel/citadel.nsi | 2 - citadel/citadel.spec | 1 - citadel/configure.ac | 2 +- citadel/serv_upgrade.c | 119 +++++++--------------------------------- citadel/serv_upgrade.h | 24 -------- citadel/serv_vandelay.c | 2 + citadel/setup.c | 21 ++----- 10 files changed, 40 insertions(+), 153 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 4d61e8183..3556973d2 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 608.12 2003/07/30 00:26:50 ajc + * Removed the "weekly" script and began installing a facility to allow + database maintenance to happen automatically. (One Step Install can't + require the sysadmin to know cron) + Revision 608.11 2003/07/28 04:17:24 ajc * migratenet.c: removed. Adjusted Makefile.in accordingly. @@ -4914,3 +4919,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 008d3c943..01dcfed66 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -191,7 +191,7 @@ install-doc: $(INSTALL_DATA) $$i $(root)$(prefix)/$$i; \ done -install-exec: all weekly +install-exec: all @for i in bio bitbucket files images info userpics; do \ $(srcdir)/mkinstalldirs $(root)$(prefix)/$$i; \ done @@ -201,7 +201,7 @@ install-exec: all weekly $(INSTALL) $$i $(root)$(prefix)/$$i; \ fi \ done - @for i in utilsmenu weekly ; do \ + @for i in utilsmenu ; do \ if test -f $(srcdir)/$$i; then \ echo $(INSTALL) $(srcdir)/$$i $(root)$(prefix)/$$i; \ $(INSTALL) $(srcdir)/$$i $(root)$(prefix)/$$i; \ @@ -220,7 +220,7 @@ cleaner: clean distclean: cleaner find . -name '*~' -o -name '.#*' | xargs rm -f - rm -f Makefile sysdep.h config.cache config/.og config.status *.d weekly + rm -f Makefile sysdep.h config.cache config/.og config.status *.d .c.d: @echo Checking dependencies for $< @@ -239,7 +239,4 @@ $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4 $(srcdir)/aclocal.m4: $(srcdir)/acinclude.m4 cd $(srcdir) && $(ACLOCAL) -weekly: $(srcdir)/weekly.in config.status - CONFIG_FILES=weekly CONFIG_HEADERS= $(SHELL) ./config.status - -include $(DEP_FILES) diff --git a/citadel/citadel.h b/citadel/citadel.h index 3e970484b..d746caa91 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -32,7 +32,7 @@ extern "C" { /* * Text description of this software */ -#define CITADEL "Citadel/UX 6.08" +#define CITADEL "Citadel/UX 6.09" /* * REV_LEVEL is the current version number (multiplied by 100 to avoid having @@ -44,9 +44,9 @@ extern "C" { * usually more strict because you're not really supposed to dump/load and * upgrade at the same time. */ -#define REV_LEVEL 608 /* This version */ +#define REV_LEVEL 609 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ -#define EXPORT_REV_MIN 608 /* Oldest compatible export files */ +#define EXPORT_REV_MIN 609 /* Oldest compatible export files */ #define SERVER_TYPE 0 /* zero for stock Citadel/UX; other developers please obtain SERVER_TYPE codes for your implementations */ @@ -127,6 +127,7 @@ struct config { char c_aide_mailboxes; /* give Aides access to mailboxes */ char c_baseroom[ROOMNAMELEN]; /* Name of baseroom (Lobby) */ char c_aideroom[ROOMNAMELEN]; /* Name of aideroom (Aide) */ + int c_purge_hour; /* Hour during which db purges run */ }; /* diff --git a/citadel/citadel.nsi b/citadel/citadel.nsi index 125f805ea..4ceac0a90 100644 --- a/citadel/citadel.nsi +++ b/citadel/citadel.nsi @@ -70,7 +70,6 @@ SetOutPath "$INSTDIR" File C:\cygwin\home\error\cvs\citadel\citserver.exe File C:\cygwin\bin\cygz.dll File C:\cygwin\home\error\cvs\citadel\base64.exe -File C:\cygwin\home\error\cvs\citadel\weekly File C:\cygwin\home\error\cvs\citadel\setup.exe File C:\cygwin\home\error\cvs\citadel\sendcommand.exe File C:\cygwin\home\error\cvs\citadel\docs\citadel.html @@ -122,7 +121,6 @@ Delete /rebootok "$INSTDIR\cygssl-0.9.7.dll" Delete /rebootok "$INSTDIR\rxvt.exe" Delete /rebootok "$INSTDIR\citserver.exe" Delete /rebootok "$INSTDIR\base64.exe" -Delete /rebootok "$INSTDIR\weekly" Delete /rebootok "$INSTDIR\setup.exe" Delete /rebootok "$INSTDIR\aidepost.exe" Delete /rebootok "$INSTDIR\citmail.exe" diff --git a/citadel/citadel.spec b/citadel/citadel.spec index cb1f81944..bf29d9438 100644 --- a/citadel/citadel.spec +++ b/citadel/citadel.spec @@ -82,7 +82,6 @@ upgrading this package. /usr/local/citadel/stats /usr/local/citadel/userlist /usr/local/citadel/utilsmenu -/usr/local/citadel/weekly /usr/local/citadel/modules/libbio.so /usr/local/citadel/modules/libbio.la /usr/local/citadel/modules/libchat.so diff --git a/citadel/configure.ac b/citadel/configure.ac index b18a71902..c0aa5336c 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -564,7 +564,7 @@ AC_SUBST(SERVER_LDFLAGS) AC_SUBST(SERVER_LIBS) AC_SUBST(SETUP_LIBS) AC_CONFIG_HEADER(sysdep.h) -AC_CONFIG_FILES([Makefile weekly]) +AC_CONFIG_FILES([Makefile]) AC_OUTPUT if test -z "$DATABASE"; then diff --git a/citadel/serv_upgrade.c b/citadel/serv_upgrade.c index d206176b6..9e4c9324b 100644 --- a/citadel/serv_upgrade.c +++ b/citadel/serv_upgrade.c @@ -44,90 +44,6 @@ #include "tools.h" #include "serv_upgrade.h" -void do_pre555_user_upgrade(void) { - struct pre555user usbuf; - struct ctdluser newus; - struct cdbdata *cdbus; - char tempfilename[PATH_MAX]; - FILE *fp, *tp; - static char vcard[1024]; - - lprintf(5, "Upgrading user file\n"); - fp = tmpfile(); - if (fp == NULL) { - lprintf(1, "%s\n", strerror(errno)); - exit(errno); - } - strcpy(tempfilename, tmpnam(NULL)); - - /* First, back out all old version records to a flat file */ - cdb_rewind(CDB_USERS); - while(cdbus = cdb_next_item(CDB_USERS), cdbus != NULL) { - memset(&usbuf, 0, sizeof(struct pre555user)); - memcpy(&usbuf, cdbus->ptr, - ( (cdbus->len > sizeof(struct pre555user)) ? - sizeof(struct pre555user) : cdbus->len) ); - cdb_free(cdbus); - fwrite(&usbuf, sizeof(struct pre555user), 1, fp); - } - - /* ...and overwrite the records with new format records */ - rewind(fp); - while (fread(&usbuf, sizeof(struct pre555user), 1, fp) > 0) { - if (strlen(usbuf.fullname) > 0) { - lprintf(9, "Upgrading <%s>\n", usbuf.fullname); - memset(&newus, 0, sizeof(struct ctdluser)); - - newus.uid = usbuf.USuid; - strcpy(newus.password, usbuf.password); - newus.flags = usbuf.flags; - newus.timescalled = (long) usbuf.timescalled; - newus.posted = (long) usbuf.posted; - newus.axlevel = (cit_uint8_t) usbuf.axlevel; - newus.usernum = (long) usbuf.usernum; - newus.lastcall = (long) usbuf.lastcall; - newus.USuserpurge = (int) usbuf.USuserpurge; - strcpy(newus.fullname, usbuf.fullname); - newus.USscreenwidth = (cit_uint8_t) usbuf.USscreenwidth; - newus.USscreenheight = (cit_uint8_t) usbuf.USscreenheight; - - putuser(&newus); - - /* write the vcard */ - snprintf(vcard, sizeof vcard, - "Content-type: text/x-vcard\n\n" - "begin:vcard\n" - "n:%s\n" - "tel;home:%s\n" - "email;internet:%s\n" - "adr:;;%s;%s;%s;%s;USA\n" - "end:vcard\n", - usbuf.USname, - usbuf.USphone, - usbuf.USemail, - usbuf.USaddr, - usbuf.UScity, - usbuf.USstate, - usbuf.USzip); - - tp = fopen(tempfilename, "w"); - fwrite(vcard, strlen(vcard)+1, 1, tp); - fclose(tp); - - CtdlWriteObject(USERCONFIGROOM, "text/x-vcard", - tempfilename, &newus, 0, 1, CM_SKIP_HOOKS); - unlink(tempfilename); - } - } - - fclose(fp); /* this file deletes automatically */ -} - - - - - - /* @@ -234,14 +150,20 @@ void convert_bbsuid_to_minusone(void) { return; } - /* - * This field was originally used for something else, so when we upgrade - * we have to initialize it to 0 in case there was trash in that space. + * Do various things to our configuration file */ -void initialize_c_rfc822_strict_from(void) { +void update_config(void) { get_config(); - config.c_rfc822_strict_from = 0; + + if (CitControl.version < 606) { + config.c_rfc822_strict_from = 0; + } + + if (CitControl.version < 609) { + config.c_purge_hour = 3; + } + put_config(); } @@ -263,9 +185,15 @@ void check_server_upgrades(void) { return; } - if (CitControl.version < 555) do_pre555_user_upgrade(); + update_config(); + + if (CitControl.version < 555) { + lprintf(1, "Your data files are from a version of Citadel\n" + "that is too old to be upgraded. Sorry.\n"); + exit(EXIT_FAILURE); + } + if (CitControl.version < 591) bump_mailbox_generation_numbers(); - if (CitControl.version < 606) initialize_c_rfc822_strict_from(); if (CitControl.version < 608) convert_bbsuid_to_minusone(); CitControl.version = REV_LEVEL; @@ -273,15 +201,6 @@ void check_server_upgrades(void) { } - - - - - - - - - char *serv_upgrade_init(void) { check_server_upgrades(); diff --git a/citadel/serv_upgrade.h b/citadel/serv_upgrade.h index c8b2d6a1a..8d8bc3202 100644 --- a/citadel/serv_upgrade.h +++ b/citadel/serv_upgrade.h @@ -3,27 +3,3 @@ * */ -/* - * Format of a user record prior to version 5.55 - */ -struct pre555user { /* User record */ - int USuid; /* userid (==BBSUID for bbs only) */ - char password[20]; /* password (for BBS-only users) */ - unsigned flags; /* See US_ flags below */ - int timescalled; /* Total number of logins */ - int posted; /* Number of messages posted (ever) */ - char fullname[26]; /* Name for Citadel messages & mail */ - char axlevel; /* Access level */ - cit_uint8_t USscreenwidth; /* Screen width (for textmode users)*/ - cit_uint8_t USscreenheight; /* Screen height(for textmode users)*/ - long usernum; /* User number (never recycled) */ - time_t lastcall; /* Last time the user called */ - char USname[30]; /* */ - char USaddr[25]; /* */ - char UScity[15]; /* */ - char USstate[3]; /* */ - char USzip[10]; /* */ - char USphone[11]; /* */ - char USemail[32]; /* */ - int USuserpurge; /* Purge time (in days) for user */ -}; diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index 1608804b5..2ef114d47 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -282,6 +282,7 @@ void artv_do_export(void) { cprintf("%d\n", config.c_max_workers); cprintf("%d\n", config.c_pop3_port); cprintf("%d\n", config.c_smtp_port); + cprintf("%d\n", config.c_purge_hour); /* Export the control file */ get_control(); @@ -339,6 +340,7 @@ void artv_import_config(void) { client_gets(buf); config.c_max_workers = atoi(buf); client_gets(buf); config.c_pop3_port = atoi(buf); client_gets(buf); config.c_smtp_port = atoi(buf); + client_gets(buf); config.c_purge_hour = atoi(buf); put_config(); lprintf(7, "Imported config file\n"); } diff --git a/citadel/setup.c b/citadel/setup.c index 2113246c3..11dfd1054 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -920,10 +920,11 @@ int main(int argc, char *argv[]) old_setup_level = config.c_setup_level; - if (old_setup_level == 0) + if (old_setup_level == 0) { goto NEW_INST; + } - if (old_setup_level < 323) { + if (old_setup_level < 555) { important_message("Citadel/UX Setup", "This Citadel/UX installation is too old " "to be upgraded."); @@ -931,17 +932,6 @@ int main(int argc, char *argv[]) } write_config_to_disk(); - if ((config.c_setup_level / 10) == 32) { - important_msgnum(31); - cleanup(0); - } - if (config.c_setup_level < 400) { - config.c_setup_level = 400; - } - /* end of 3.23 -> 4.00 update section */ - - /* end of 4.00 -> 4.02 update section */ - old_setup_level = config.c_setup_level; /* end of version update section */ @@ -961,11 +951,10 @@ NEW_INST: mkdir("images", 0700); mkdir("netconfigs", 0700); - /* Delete a bunch of old files from Citadel v4; don't need anymore */ + /* Delete files and directories used by older Citadel versions */ system("rm -fr ./chatpipes ./expressmsgs ./sessions 2>/dev/null"); - - /* Delete the old citadel.log file; this facility has been removed */ unlink("citadel.log"); + unlink("weekly"); check_services_entry(); /* Check /etc/services */ #ifndef __CYGWIN__ -- 2.39.2