*
* You might also see this module affectionately referred to as the DAP (the Dreaded Auto-Purger).
*
- * Copyright (c) 1988-2017 by citadel.org (Art Cancro, Wilifried Goesgens, and others)
+ * Copyright (c) 1988-2018 by citadel.org (Art Cancro, Wilifried Goesgens, and others)
*
* 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
/*
- * Purge OpenID assocations for missing users (theoretically this will never delete anything)
+ * Purge external auth assocations for missing users (theoretically this will never delete anything)
*/
-int PurgeStaleOpenIDassociations(void) {
+int PurgeStaleExtAuthAssociations(void) {
struct cdbdata *cdboi;
struct ctdluser usbuf;
HashList *keys = NULL;
if (!keys) return(0);
- cdb_rewind(CDB_OPENID);
- while (cdboi = cdb_next_item(CDB_OPENID), cdboi != NULL) {
+ cdb_rewind(CDB_EXTAUTH);
+ while (cdboi = cdb_next_item(CDB_EXTAUTH), cdboi != NULL) {
if (cdboi->len > sizeof(long)) {
memcpy(&usernum, cdboi->ptr, sizeof(long));
if (CtdlGetUserByNumber(&usbuf, usernum) != 0) {
HashPos = GetNewHashPos(keys, 0);
while (GetNextHashPos(keys, HashPos, &len, &Key, &Value)!=0)
{
- syslog(LOG_DEBUG, "Deleting associated OpenID <%s>", (char*)Value);
- cdb_delete(CDB_OPENID, Value, strlen(Value));
+ syslog(LOG_DEBUG, "Deleting associated external authenticator <%s>", (char*)Value);
+ cdb_delete(CDB_EXTAUTH, Value, strlen(Value));
/* note: don't free(Value) -- deleting the hash list will handle this for us */
++num_deleted;
}
ErrMsg = NewStrBuf ();
retval = PurgeUseTable(ErrMsg);
syslog(LOG_NOTICE, "Purged %d entries from the use table.", retval);
-////TODO: fix errmsg
FreeStrBuf(&ErrMsg);
}
if (!server_shutting_down)
{
- retval = PurgeStaleOpenIDassociations();
- syslog(LOG_NOTICE, "Purged %d stale OpenID associations.", retval);
+ retval = PurgeStaleExtAuthAssociations();
+ syslog(LOG_NOTICE, "Purged %d stale external auth associations.", retval);
}
- if (!server_shutting_down)
+ //if (!server_shutting_down)
+ //{
+ // FIXME this is where we could do a non-interactive delete of zero-refcount messages
+ //}
+
+ if ( (!server_shutting_down) && (CtdlGetConfigInt("c_shrink_db_files") != 0) )
{
- retval = TDAP_ProcessAdjRefCountQueue();
- syslog(LOG_NOTICE, "Processed %d message reference count adjustments.", retval);
+ cdb_compact(); // Shrink the DB files on disk
}
if (!server_shutting_down)
{
syslog(LOG_INFO, "Auto-purger: finished.");
- last_purge = now; /* So we don't do it again soon */
+ last_purge = now; // So we don't do it again soon
force_purge_now = 0;
}
else {