2 * This module handles the expiry of old messages and the purging of old users.
4 * You might also see this module affectionately referred to as the DAP (the Dreaded Auto-Purger).
6 * Copyright (c) 1988-2018 by citadel.org (Art Cancro, Wilifried Goesgens, and others)
8 * This program is open source software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * A brief technical discussion:
20 * Several of the purge operations found in this module operate in two
21 * stages: the first stage generates a linked list of objects to be deleted,
22 * then the second stage deletes all listed objects from the database.
24 * At first glance this may seem cumbersome and unnecessary. The reason it is
25 * implemented in this way is because Berkeley DB, and possibly other backends
26 * we may hook into in the future, explicitly do _not_ support the deletion of
27 * records from a file while the file is being traversed. The delete operation
28 * will succeed, but the traversal is not guaranteed to visit every object if
29 * this is done. Therefore we utilize the two-stage purge.
31 * When using Berkeley DB, there's another reason for the two-phase purge: we
32 * don't want the entire thing being done as one huge transaction.
34 * You'll also notice that we build the in-memory list of records to be deleted
35 * sometimes with a linked list and sometimes with a hash table. There is no
36 * reason for this aside from the fact that the linked list ones were written
37 * before we had the hash table library available.
49 #include <sys/types.h>
51 #if TIME_WITH_SYS_TIME
52 # include <sys/time.h>
56 # include <sys/time.h>
65 #include <libcitadel.h>
68 #include "citserver.h"
79 #include "ctdl_module.h"
83 struct PurgeList *next;
84 char name[ROOMNAMELEN]; /* use the larger of username or roomname */
88 struct VPurgeList *next;
95 struct ValidRoom *next;
101 struct ValidUser *next;
106 struct ctdlroomref *next;
111 struct UPurgeList *next;
116 struct EPurgeList *next;
122 struct PurgeList *UserPurgeList = NULL;
123 struct PurgeList *RoomPurgeList = NULL;
124 struct ValidRoom *ValidRoomList = NULL;
125 struct ValidUser *ValidUserList = NULL;
127 int users_not_purged;
128 char *users_corrupt_msg = NULL;
129 char *users_zero_msg = NULL;
130 struct ctdlroomref *rr = NULL;
131 int force_purge_now = 0; /* set to nonzero to force a run right now */
135 * First phase of message purge -- gather the locations of messages which
136 * qualify for purging and write them to a temp file.
138 void GatherPurgeMessages(struct ctdlroom *qrbuf, void *data) {
139 struct ExpirePolicy epbuf;
142 struct CtdlMessage *msg = NULL;
144 struct cdbdata *cdbfr;
145 long *msglist = NULL;
149 purgelist = (FILE *)data;
150 fprintf(purgelist, "r=%s\n", qrbuf->QRname);
153 GetExpirePolicy(&epbuf, qrbuf);
155 /* If the room is set to never expire messages ... do nothing */
156 if (epbuf.expire_mode == EXPIRE_NEXTLEVEL) return;
157 if (epbuf.expire_mode == EXPIRE_MANUAL) return;
159 /* Don't purge messages containing system configuration, dumbass. */
160 if (!strcasecmp(qrbuf->QRname, SYSCONFIGROOM)) return;
162 /* Ok, we got this far ... now let's see what's in the room */
163 cdbfr = cdb_fetch(CDB_MSGLISTS, &qrbuf->QRnumber, sizeof(long));
166 msglist = malloc(cdbfr->len);
167 memcpy(msglist, cdbfr->ptr, cdbfr->len);
168 num_msgs = cdbfr->len / sizeof(long);
172 /* Nothing to do if there aren't any messages */
174 if (msglist != NULL) free(msglist);
178 /* If the room is set to expire by count, do that */
179 if (epbuf.expire_mode == EXPIRE_NUMMSGS) {
180 if (num_msgs > epbuf.expire_value) {
181 for (a=0; a<(num_msgs - epbuf.expire_value); ++a) {
182 fprintf(purgelist, "m=%ld\n", msglist[a]);
188 /* If the room is set to expire by age... */
189 if (epbuf.expire_mode == EXPIRE_AGE) {
190 for (a=0; a<num_msgs; ++a) {
193 msg = CtdlFetchMessage(delnum, 0, 1); /* dont need body */
195 xtime = atol(msg->cm_fields[eTimestamp]);
202 && (now - xtime > (time_t)(epbuf.expire_value * 86400L))) {
203 fprintf(purgelist, "m=%ld\n", delnum);
209 if (msglist != NULL) free(msglist);
214 * Second phase of message purge -- read list of msgs from temp file and
217 void DoPurgeMessages(FILE *purgelist) {
218 char roomname[ROOMNAMELEN];
223 strcpy(roomname, "nonexistent room ___ ___");
224 while (fgets(buf, sizeof buf, purgelist) != NULL) {
225 buf[strlen(buf)-1]=0;
226 if (!strncasecmp(buf, "r=", 2)) {
227 strcpy(roomname, &buf[2]);
229 if (!strncasecmp(buf, "m=", 2)) {
230 msgnum = atol(&buf[2]);
232 CtdlDeleteMessages(roomname, &msgnum, 1, "");
239 void PurgeMessages(void) {
242 syslog(LOG_DEBUG, "PurgeMessages() called");
245 purgelist = tmpfile();
246 if (purgelist == NULL) {
247 syslog(LOG_CRIT, "Can't create purgelist temp file: %s", strerror(errno));
251 CtdlForEachRoom(GatherPurgeMessages, (void *)purgelist );
252 DoPurgeMessages(purgelist);
257 void AddValidUser(struct ctdluser *usbuf, void *data) {
258 struct ValidUser *vuptr;
260 vuptr = (struct ValidUser *)malloc(sizeof(struct ValidUser));
261 vuptr->next = ValidUserList;
262 vuptr->vu_usernum = usbuf->usernum;
263 ValidUserList = vuptr;
266 void AddValidRoom(struct ctdlroom *qrbuf, void *data) {
267 struct ValidRoom *vrptr;
269 vrptr = (struct ValidRoom *)malloc(sizeof(struct ValidRoom));
270 vrptr->next = ValidRoomList;
271 vrptr->vr_roomnum = qrbuf->QRnumber;
272 vrptr->vr_roomgen = qrbuf->QRgen;
273 ValidRoomList = vrptr;
276 void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) {
277 time_t age, purge_secs;
278 struct PurgeList *pptr;
279 struct ValidUser *vuptr;
282 /* For mailbox rooms, there's only one purging rule: if the user who
283 * owns the room still exists, we keep the room; otherwise, we purge
284 * it. Bypass any other rules.
286 if (qrbuf->QRflags & QR_MAILBOX) {
287 /* if user not found, do_purge will be 1 */
289 for (vuptr=ValidUserList; vuptr!=NULL; vuptr=vuptr->next) {
290 if (vuptr->vu_usernum == atol(qrbuf->QRname)) {
296 /* Any of these attributes render a room non-purgable */
297 if (qrbuf->QRflags & QR_PERMANENT) return;
298 if (qrbuf->QRflags & QR_DIRECTORY) return;
299 if (qrbuf->QRflags & QR_NETWORK) return;
300 if (qrbuf->QRflags2 & QR2_SYSTEM) return;
301 if (!strcasecmp(qrbuf->QRname, SYSCONFIGROOM)) return;
302 if (CtdlIsNonEditable(qrbuf)) return;
304 /* If we don't know the modification date, be safe and don't purge */
305 if (qrbuf->QRmtime <= (time_t)0) return;
307 /* If no room purge time is set, be safe and don't purge */
308 if (CtdlGetConfigLong("c_roompurge") < 0) return;
310 /* Otherwise, check the date of last modification */
311 age = time(NULL) - (qrbuf->QRmtime);
312 purge_secs = CtdlGetConfigLong("c_roompurge") * 86400;
313 if (purge_secs <= (time_t)0) return;
314 syslog(LOG_DEBUG, "<%s> is <%ld> seconds old", qrbuf->QRname, (long)age);
315 if (age > purge_secs) do_purge = 1;
319 pptr = (struct PurgeList *) malloc(sizeof(struct PurgeList));
320 pptr->next = RoomPurgeList;
321 strcpy(pptr->name, qrbuf->QRname);
322 RoomPurgeList = pptr;
328 int PurgeRooms(void) {
329 struct PurgeList *pptr;
330 int num_rooms_purged = 0;
331 struct ctdlroom qrbuf;
332 struct ValidUser *vuptr;
333 char *transcript = NULL;
335 syslog(LOG_DEBUG, "PurgeRooms() called");
337 /* Load up a table full of valid user numbers so we can delete
338 * user-owned rooms for users who no longer exist */
339 ForEachUser(AddValidUser, NULL);
341 /* Then cycle through the room file */
342 CtdlForEachRoom(DoPurgeRooms, NULL);
344 /* Free the valid user list */
345 while (ValidUserList != NULL) {
346 vuptr = ValidUserList->next;
348 ValidUserList = vuptr;
351 transcript = malloc(SIZ);
352 strcpy(transcript, "The following rooms have been auto-purged:\n");
354 while (RoomPurgeList != NULL) {
355 if (CtdlGetRoom(&qrbuf, RoomPurgeList->name) == 0) {
356 transcript=realloc(transcript, strlen(transcript)+SIZ);
357 snprintf(&transcript[strlen(transcript)], SIZ, " %s\n",
359 CtdlDeleteRoom(&qrbuf);
361 pptr = RoomPurgeList->next;
363 RoomPurgeList = pptr;
367 if (num_rooms_purged > 0) CtdlAideMessage(transcript, "Room Autopurger Message");
370 syslog(LOG_DEBUG, "Purged %d rooms.", num_rooms_purged);
371 return(num_rooms_purged);
376 * Back end function to check user accounts for associated Unix accounts
377 * which no longer exist. (Only relevant for host auth mode.)
379 void do_uid_user_purge(struct ctdluser *us, void *data) {
380 struct PurgeList *pptr;
382 if ((us->uid != (-1)) && (us->uid != CTDLUID)) {
383 if (getpwuid(us->uid) == NULL) {
384 pptr = (struct PurgeList *)
385 malloc(sizeof(struct PurgeList));
386 pptr->next = UserPurgeList;
387 strcpy(pptr->name, us->fullname);
388 UserPurgeList = pptr;
398 * Back end function to check user accounts for expiration.
400 void do_user_purge(struct ctdluser *us, void *data) {
404 struct PurgeList *pptr;
406 /* Set purge time; if the user overrides the system default, use it */
407 if (us->USuserpurge > 0) {
408 purge_time = ((time_t)us->USuserpurge) * 86400;
411 purge_time = CtdlGetConfigLong("c_userpurge") * 86400;
414 /* The default rule is to not purge. */
417 /* If the user hasn't called in two months and expiring of accounts is turned on, his/her account
418 * has expired, so purge the record.
420 if (CtdlGetConfigLong("c_userpurge") > 0)
423 if ((now - us->lastcall) > purge_time) purge = 1;
426 /* If the record is marked as permanent, don't purge it.
428 if (us->flags & US_PERM) purge = 0;
430 /* If the user is an Aide, don't purge him/her/it.
432 if (us->axlevel == 6) purge = 0;
434 /* If the access level is 0, the record should already have been
435 * deleted, but maybe the user was logged in at the time or something.
436 * Delete the record now.
438 if (us->axlevel == 0) purge = 1;
440 /* If the user set his/her password to 'deleteme', he/she
441 * wishes to be deleted, so purge the record.
442 * Moved this lower down so that aides and permanent users get purged if they ask to be.
444 if (!strcasecmp(us->password, "deleteme")) purge = 1;
446 /* 0 calls is impossible. If there are 0 calls, it must
447 * be a corrupted record, so purge it.
448 * Actually it is possible if an Aide created the user so now we check for less than 0 (DRW)
450 if (us->timescalled < 0) purge = 1;
452 /* any negative user number, is
455 if (us->usernum < 0L) purge = 1;
457 /* Don't purge user 0. That user is there for the system */
458 if (us->usernum == 0L)
460 /* FIXME: Temporary log message. Until we do unauth access with user 0 we should
461 * try to get rid of all user 0 occurences. Many will be remnants from old code so
462 * we will need to try and purge them from users data bases.Some will not have names but
463 * those with names should be purged.
465 syslog(LOG_DEBUG, "Auto purger found a user 0 with name <%s>", us->fullname);
469 /* If the user has no full name entry then we can't purge them
470 * since the actual purge can't find them.
471 * This shouldn't happen but does somehow.
473 if (IsEmptyStr(us->fullname))
477 if (us->usernum > 0L)
480 if (users_corrupt_msg == NULL)
482 users_corrupt_msg = malloc(SIZ);
483 strcpy(users_corrupt_msg,
484 "The auto-purger found the following user numbers with no name.\n"
485 "The system has no way to purge a user with no name,"
486 " and should not be able to create them either.\n"
487 "This indicates corruption of the user DB or possibly a bug.\n"
488 "It may be a good idea to restore your DB from a backup.\n"
492 users_corrupt_msg=realloc(users_corrupt_msg, strlen(users_corrupt_msg)+30);
493 snprintf(&users_corrupt_msg[strlen(users_corrupt_msg)], 29, " %ld\n", us->usernum);
498 pptr = (struct PurgeList *) malloc(sizeof(struct PurgeList));
499 pptr->next = UserPurgeList;
500 strcpy(pptr->name, us->fullname);
501 UserPurgeList = pptr;
510 int PurgeUsers(void) {
511 struct PurgeList *pptr;
512 int num_users_purged = 0;
513 char *transcript = NULL;
515 syslog(LOG_DEBUG, "PurgeUsers() called");
516 users_not_purged = 0;
518 switch(CtdlGetConfigInt("c_auth_mode")) {
519 case AUTHMODE_NATIVE:
520 ForEachUser(do_user_purge, NULL);
523 ForEachUser(do_uid_user_purge, NULL);
526 syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.", CtdlGetConfigInt("c_auth_mode"));
530 transcript = malloc(SIZ);
532 if (users_not_purged == 0) {
533 strcpy(transcript, "The auto-purger was told to purge every user. It is\n"
534 "refusing to do this because it usually indicates a problem\n"
535 "such as an inability to communicate with a name service.\n"
537 while (UserPurgeList != NULL) {
538 pptr = UserPurgeList->next;
540 UserPurgeList = pptr;
546 strcpy(transcript, "The following users have been auto-purged:\n");
547 while (UserPurgeList != NULL) {
548 transcript=realloc(transcript, strlen(transcript)+SIZ);
549 snprintf(&transcript[strlen(transcript)], SIZ, " %s\n",
550 UserPurgeList->name);
551 purge_user(UserPurgeList->name);
552 pptr = UserPurgeList->next;
554 UserPurgeList = pptr;
559 if (num_users_purged > 0) CtdlAideMessage(transcript, "User Purge Message");
562 if(users_corrupt_msg)
564 CtdlAideMessage(users_corrupt_msg, "User Corruption Message");
565 free (users_corrupt_msg);
566 users_corrupt_msg = NULL;
571 CtdlAideMessage(users_zero_msg, "User Zero Message");
572 free (users_zero_msg);
573 users_zero_msg = NULL;
576 syslog(LOG_DEBUG, "Purged %d users.", num_users_purged);
577 return(num_users_purged);
584 * This is a really cumbersome "garbage collection" function. We have to
585 * delete visits which refer to rooms and/or users which no longer exist. In
586 * order to prevent endless traversals of the room and user files, we first
587 * build linked lists of rooms and users which _do_ exist on the system, then
588 * traverse the visit file, checking each record against those two lists and
589 * purging the ones that do not have a match on _both_ lists. (Remember, if
590 * either the room or user being referred to is no longer on the system, the
591 * record is completely useless.)
593 int PurgeVisits(void) {
594 struct cdbdata *cdbvisit;
596 struct VPurgeList *VisitPurgeList = NULL;
597 struct VPurgeList *vptr;
601 struct ValidRoom *vrptr;
602 struct ValidUser *vuptr;
603 int RoomIsValid, UserIsValid;
605 /* First, load up a table full of valid room/gen combinations */
606 CtdlForEachRoom(AddValidRoom, NULL);
608 /* Then load up a table full of valid user numbers */
609 ForEachUser(AddValidUser, NULL);
611 /* Now traverse through the visits, purging irrelevant records... */
612 cdb_rewind(CDB_VISIT);
613 while(cdbvisit = cdb_next_item(CDB_VISIT), cdbvisit != NULL) {
614 memset(&vbuf, 0, sizeof(visit));
615 memcpy(&vbuf, cdbvisit->ptr,
616 ( (cdbvisit->len > sizeof(visit)) ?
617 sizeof(visit) : cdbvisit->len) );
623 /* Check to see if the room exists */
624 for (vrptr=ValidRoomList; vrptr!=NULL; vrptr=vrptr->next) {
625 if ( (vrptr->vr_roomnum==vbuf.v_roomnum)
626 && (vrptr->vr_roomgen==vbuf.v_roomgen))
630 /* Check to see if the user exists */
631 for (vuptr=ValidUserList; vuptr!=NULL; vuptr=vuptr->next) {
632 if (vuptr->vu_usernum == vbuf.v_usernum)
636 /* Put the record on the purge list if it's dead */
637 if ((RoomIsValid==0) || (UserIsValid==0)) {
638 vptr = (struct VPurgeList *)
639 malloc(sizeof(struct VPurgeList));
640 vptr->next = VisitPurgeList;
641 vptr->vp_roomnum = vbuf.v_roomnum;
642 vptr->vp_roomgen = vbuf.v_roomgen;
643 vptr->vp_usernum = vbuf.v_usernum;
644 VisitPurgeList = vptr;
649 /* Free the valid room/gen combination list */
650 while (ValidRoomList != NULL) {
651 vrptr = ValidRoomList->next;
653 ValidRoomList = vrptr;
656 /* Free the valid user list */
657 while (ValidUserList != NULL) {
658 vuptr = ValidUserList->next;
660 ValidUserList = vuptr;
663 /* Now delete every visit on the purged list */
664 while (VisitPurgeList != NULL) {
665 IndexLen = GenerateRelationshipIndex(IndexBuf,
666 VisitPurgeList->vp_roomnum,
667 VisitPurgeList->vp_roomgen,
668 VisitPurgeList->vp_usernum);
669 cdb_delete(CDB_VISIT, IndexBuf, IndexLen);
670 vptr = VisitPurgeList->next;
671 free(VisitPurgeList);
672 VisitPurgeList = vptr;
681 * Purge the use table of old entries.
684 int PurgeUseTable(StrBuf *ErrMsg) {
686 struct cdbdata *cdbut;
688 struct UPurgeList *ul = NULL;
689 struct UPurgeList *uptr;
691 /* Phase 1: traverse through the table, discovering old records... */
693 syslog(LOG_DEBUG, "Purge use table: phase 1");
694 cdb_rewind(CDB_USETABLE);
695 while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL)
697 if (cdbut->len > sizeof(struct UseTable))
698 memcpy(&ut, cdbut->ptr, sizeof(struct UseTable));
701 memset(&ut, 0, sizeof(struct UseTable));
702 memcpy(&ut, cdbut->ptr, cdbut->len);
706 if ( (time(NULL) - ut.ut_timestamp) > USETABLE_RETAIN )
708 uptr = (struct UPurgeList *) malloc(sizeof(struct UPurgeList));
712 safestrncpy(uptr->up_key, ut.ut_msgid, sizeof uptr->up_key);
720 /* Phase 2: delete the records */
721 syslog(LOG_DEBUG, "Purge use table: phase 2");
723 cdb_delete(CDB_USETABLE, ul->up_key, strlen(ul->up_key));
729 syslog(LOG_DEBUG, "Purge use table: finished (purged %d records)", purged);
735 * Purge the EUID Index of old records.
738 int PurgeEuidIndexTable(void) {
740 struct cdbdata *cdbei;
741 struct EPurgeList *el = NULL;
742 struct EPurgeList *eptr;
744 struct CtdlMessage *msg = NULL;
746 /* Phase 1: traverse through the table, discovering old records... */
747 syslog(LOG_DEBUG, "Purge EUID index: phase 1");
748 cdb_rewind(CDB_EUIDINDEX);
749 while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei != NULL) {
751 memcpy(&msgnum, cdbei->ptr, sizeof(long));
753 msg = CtdlFetchMessage(msgnum, 0, 1);
755 CM_Free(msg); /* it still exists, so do nothing */
758 eptr = (struct EPurgeList *) malloc(sizeof(struct EPurgeList));
761 eptr->ep_keylen = cdbei->len - sizeof(long);
762 eptr->ep_key = malloc(cdbei->len);
763 memcpy(eptr->ep_key, &cdbei->ptr[sizeof(long)], eptr->ep_keylen);
773 /* Phase 2: delete the records */
774 syslog(LOG_DEBUG, "Purge euid index: phase 2");
776 cdb_delete(CDB_EUIDINDEX, el->ep_key, el->ep_keylen);
783 syslog(LOG_DEBUG, "Purge euid index: finished (purged %d records)", purged);
789 * Purge external auth assocations for missing users (theoretically this will never delete anything)
791 int PurgeStaleExtAuthAssociations(void) {
792 struct cdbdata *cdboi;
793 struct ctdluser usbuf;
794 HashList *keys = NULL;
796 char *deleteme = NULL;
803 keys = NewHash(1, NULL);
804 if (!keys) return(0);
807 cdb_rewind(CDB_EXTAUTH);
808 while (cdboi = cdb_next_item(CDB_EXTAUTH), cdboi != NULL) {
809 if (cdboi->len > sizeof(long)) {
810 memcpy(&usernum, cdboi->ptr, sizeof(long));
811 if (CtdlGetUserByNumber(&usbuf, usernum) != 0) {
812 deleteme = strdup(cdboi->ptr + sizeof(long)),
813 Put(keys, deleteme, strlen(deleteme), deleteme, NULL);
819 /* Go through the hash list, deleting keys we stored in it */
821 HashPos = GetNewHashPos(keys, 0);
822 while (GetNextHashPos(keys, HashPos, &len, &Key, &Value)!=0)
824 syslog(LOG_DEBUG, "Deleting associated external authenticator <%s>", (char*)Value);
825 cdb_delete(CDB_EXTAUTH, Value, strlen(Value));
826 /* note: don't free(Value) -- deleting the hash list will handle this for us */
829 DeleteHashPos(&HashPos);
835 void purge_databases(void)
838 static time_t last_purge = 0;
842 /* Do the auto-purge if the current hour equals the purge hour,
843 * but not if the operation has already been performed in the
844 * last twelve hours. This is usually enough granularity.
847 localtime_r(&now, &tm);
848 if (((tm.tm_hour != CtdlGetConfigInt("c_purge_hour")) || ((now - last_purge) < 43200)) && (force_purge_now == 0))
853 syslog(LOG_INFO, "Auto-purger: starting.");
855 if (!server_shutting_down)
857 retval = PurgeUsers();
858 syslog(LOG_NOTICE, "Purged %d users.", retval);
861 if (!server_shutting_down)
864 syslog(LOG_NOTICE, "Expired %d messages.", messages_purged);
867 if (!server_shutting_down)
869 retval = PurgeRooms();
870 syslog(LOG_NOTICE, "Expired %d rooms.", retval);
873 if (!server_shutting_down)
875 retval = PurgeVisits();
876 syslog(LOG_NOTICE, "Purged %d visits.", retval);
879 if (!server_shutting_down)
883 ErrMsg = NewStrBuf ();
884 retval = PurgeUseTable(ErrMsg);
885 syslog(LOG_NOTICE, "Purged %d entries from the use table.", retval);
889 if (!server_shutting_down)
891 retval = PurgeEuidIndexTable();
892 syslog(LOG_NOTICE, "Purged %d entries from the EUID index.", retval);
895 if (!server_shutting_down)
897 retval = PurgeStaleExtAuthAssociations();
898 syslog(LOG_NOTICE, "Purged %d stale external auth associations.", retval);
901 //if (!server_shutting_down)
903 // FIXME this is where we could do a non-interactive delete of zero-refcount messages
906 if ( (!server_shutting_down) && (CtdlGetConfigInt("c_shrink_db_files") != 0) )
908 cdb_compact(); // Shrink the DB files on disk
911 if (!server_shutting_down)
913 syslog(LOG_INFO, "Auto-purger: finished.");
914 last_purge = now; // So we don't do it again soon
918 syslog(LOG_INFO, "Auto-purger: STOPPED.");
924 * Manually initiate a run of The Dreaded Auto-Purger (tm)
926 void cmd_tdap(char *argbuf) {
927 if (CtdlAccessCheck(ac_aide)) return;
929 cprintf("%d Manually initiating a purger run now.\n", CIT_OK);
933 CTDL_MODULE_INIT(expire)
937 CtdlRegisterProtoHook(cmd_tdap, "TDAP", "Manually initiate auto-purger");
938 CtdlRegisterProtoHook(cmd_gpex, "GPEX", "Get expire policy");
939 CtdlRegisterProtoHook(cmd_spex, "SPEX", "Set expire policy");
940 CtdlRegisterSessionHook(purge_databases, EVT_TIMER, PRIO_CLEANUP + 20);
943 /* return our module name for the log */