2 * This is a data store backend for the Citadel server which uses Berkeley DB.
4 * Copyright (c) 1987-2012 by the citadel.org team
6 * This program is open source software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 /*****************************************************************************
17 Tunable configuration parameters for the Berkeley DB back end
18 *****************************************************************************/
20 /* Citadel will checkpoint the db at the end of every session, but only if
21 * the specified number of kilobytes has been written, or if the specified
22 * number of minutes has passed, since the last checkpoint.
24 #define MAX_CHECKPOINT_KBYTES 256
25 #define MAX_CHECKPOINT_MINUTES 15
27 /*****************************************************************************/
36 #include <sys/types.h>
44 #elif defined(HAVE_DB4_DB_H)
47 #error Neither <db.h> nor <db4/db.h> was found by configure. Install db4-devel.
51 #if DB_VERSION_MAJOR < 4 || DB_VERSION_MINOR < 1
52 #error Citadel requires Berkeley DB v4.1 or newer. Please upgrade.
56 #include <libcitadel.h>
59 #include "citserver.h"
62 #include "sysdep_decls.h"
67 #include "ctdl_module.h"
70 static DB *dbp[MAXCDB]; /* One DB handle for each Citadel database */
71 static DB_ENV *dbenv; /* The DB environment (global) */
74 void cdb_abort(void) {
76 "citserver is stopping in order to prevent data loss. uid=%d gid=%d euid=%d egid=%d",
87 /* Verbose logging callback */
88 void cdb_verbose_log(const DB_ENV *dbenv, const char *msg)
90 if (!IsEmptyStr(msg)) {
91 syslog(LOG_DEBUG, "DB: %s", msg);
97 /* Verbose logging callback */
98 void cdb_verbose_err(const DB_ENV *dbenv, const char *errpfx, const char *msg)
101 syslog(LOG_ALERT, "DB: %s", msg);
107 /* just a little helper function */
108 static void txabort(DB_TXN * tid)
112 ret = tid->abort(tid);
115 syslog(LOG_EMERG, "bdb(): txn_abort: %s", db_strerror(ret));
120 /* this one is even more helpful than the last. */
121 static void txcommit(DB_TXN * tid)
125 ret = tid->commit(tid, 0);
128 syslog(LOG_EMERG, "bdb(): txn_commit: %s", db_strerror(ret));
133 /* are you sensing a pattern yet? */
134 static void txbegin(DB_TXN ** tid)
138 ret = dbenv->txn_begin(dbenv, NULL, tid, 0);
141 syslog(LOG_EMERG, "bdb(): txn_begin: %s", db_strerror(ret));
146 static void dbpanic(DB_ENV * env, int errval)
148 syslog(LOG_EMERG, "bdb(): PANIC: %s", db_strerror(errval));
152 static void cclose(DBC * cursor)
156 if ((ret = cursor->c_close(cursor))) {
157 syslog(LOG_EMERG, "bdb(): c_close: %s", db_strerror(ret));
162 static void bailIfCursor(DBC ** cursors, const char *msg)
166 for (i = 0; i < MAXCDB; i++)
167 if (cursors[i] != NULL) {
168 syslog(LOG_EMERG, "bdb(): cursor still in progress on cdb %02x: %s", i, msg);
174 void cdb_check_handles(void)
176 bailIfCursor(TSD->cursors, "in check_handles");
178 if (TSD->tid != NULL) {
179 syslog(LOG_EMERG, "bdb(): transaction still in progress!");
186 * Cull the database logs
188 void cdb_cull_logs(void)
197 /* Get the list of names. */
198 if ((ret = dbenv->log_archive(dbenv, &list, flags)) != 0) {
199 syslog(LOG_ERR, "cdb_cull_logs: %s", db_strerror(ret));
203 /* Print the list of names. */
205 for (file = list; *file != NULL; ++file) {
206 syslog(LOG_DEBUG, "Deleting log: %s", *file);
209 snprintf(errmsg, sizeof(errmsg),
210 " ** ERROR **\n \n \n "
211 "Citadel was unable to delete the "
212 "database log file '%s' because of the "
213 "following error:\n \n %s\n \n"
214 " This log file is no longer in use "
215 "and may be safely deleted.\n",
216 *file, strerror(errno));
217 CtdlAideMessage(errmsg, "Database Warning Message");
226 * Request a checkpoint of the database. Called once per minute by the thread manager.
228 void cdb_checkpoint(void)
232 syslog(LOG_DEBUG, "-- db checkpoint --");
233 ret = dbenv->txn_checkpoint(dbenv, MAX_CHECKPOINT_KBYTES, MAX_CHECKPOINT_MINUTES, 0);
236 syslog(LOG_EMERG, "cdb_checkpoint: txn_checkpoint: %s", db_strerror(ret));
240 /* After a successful checkpoint, we can cull the unused logs */
241 if (config.c_auto_cull) {
249 * Open the various databases we'll be using. Any database which
250 * does not exist should be created. Note that we don't need a
251 * critical section here, because there aren't any active threads
252 * manipulating the database yet.
254 void open_databases(void)
260 int dbversion_major, dbversion_minor, dbversion_patch;
261 int current_dbversion = 0;
263 syslog(LOG_DEBUG, "bdb(): open_databases() starting");
264 syslog(LOG_DEBUG, "Compiled db: %s", DB_VERSION_STRING);
265 syslog(LOG_INFO, " Linked db: %s",
266 db_version(&dbversion_major, &dbversion_minor, &dbversion_patch));
268 current_dbversion = (dbversion_major * 1000000) + (dbversion_minor * 1000) + dbversion_patch;
270 syslog(LOG_DEBUG, "Calculated dbversion: %d", current_dbversion);
271 syslog(LOG_DEBUG, " Previous dbversion: %d", CitControl.MMdbversion);
273 if ( (getenv("SUPPRESS_DBVERSION_CHECK") == NULL)
274 && (CitControl.MMdbversion > current_dbversion) ) {
275 syslog(LOG_EMERG, "You are attempting to run the Citadel server using a version");
276 syslog(LOG_EMERG, "of Berkeley DB that is older than that which last created or");
277 syslog(LOG_EMERG, "updated the database. Because this would probably cause data");
278 syslog(LOG_EMERG, "corruption or loss, the server is aborting execution now.");
282 CitControl.MMdbversion = current_dbversion;
285 syslog(LOG_INFO, "Linked zlib: %s\n", zlibVersion());
288 * Silently try to create the database subdirectory. If it's
289 * already there, no problem.
291 if ((mkdir(ctdl_data_dir, 0700) != 0) && (errno != EEXIST)){
293 "unable to create database directory [%s]: %s",
294 ctdl_data_dir, strerror(errno));
296 if (chmod(ctdl_data_dir, 0700) != 0){
298 "unable to set database directory accessrights [%s]: %s",
299 ctdl_data_dir, strerror(errno));
301 if (chown(ctdl_data_dir, CTDLUID, (-1)) != 0){
303 "unable to set the owner for [%s]: %s",
304 ctdl_data_dir, strerror(errno));
306 syslog(LOG_DEBUG, "bdb(): Setting up DB environment\n");
307 /* db_env_set_func_yield((int (*)(u_long, u_long))sched_yield); */
308 ret = db_env_create(&dbenv, 0);
310 syslog(LOG_EMERG, "bdb(): db_env_create: %s\n", db_strerror(ret));
311 syslog(LOG_EMERG, "exit code %d\n", ret);
314 dbenv->set_errpfx(dbenv, "citserver");
315 dbenv->set_paniccall(dbenv, dbpanic);
316 dbenv->set_errcall(dbenv, cdb_verbose_err);
317 dbenv->set_errpfx(dbenv, "ctdl");
318 #if (DB_VERSION_MAJOR == 4) && (DB_VERSION_MINOR >= 3)
319 dbenv->set_msgcall(dbenv, cdb_verbose_log);
321 dbenv->set_verbose(dbenv, DB_VERB_DEADLOCK, 1);
322 dbenv->set_verbose(dbenv, DB_VERB_RECOVERY, 1);
325 * We want to specify the shared memory buffer pool cachesize,
326 * but everything else is the default.
328 ret = dbenv->set_cachesize(dbenv, 0, 64 * 1024, 0);
330 syslog(LOG_EMERG, "bdb(): set_cachesize: %s\n", db_strerror(ret));
331 dbenv->close(dbenv, 0);
332 syslog(LOG_EMERG, "exit code %d\n", ret);
336 if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT))) {
337 syslog(LOG_EMERG, "bdb(): set_lk_detect: %s\n", db_strerror(ret));
338 dbenv->close(dbenv, 0);
339 syslog(LOG_EMERG, "exit code %d\n", ret);
343 flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_TXN | DB_INIT_LOCK | DB_THREAD | DB_RECOVER;
344 syslog(LOG_DEBUG, "dbenv->open(dbenv, %s, %d, 0)\n", ctdl_data_dir, flags);
345 ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
346 if (ret == DB_RUNRECOVERY) {
347 syslog(LOG_ALERT, "dbenv->open: %s\n", db_strerror(ret));
348 syslog(LOG_ALERT, "Attempting recovery...\n");
350 ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
352 if (ret == DB_RUNRECOVERY) {
353 syslog(LOG_ALERT, "dbenv->open: %s\n", db_strerror(ret));
354 syslog(LOG_ALERT, "Attempting catastrophic recovery...\n");
355 flags &= ~DB_RECOVER;
356 flags |= DB_RECOVER_FATAL;
357 ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
360 syslog(LOG_EMERG, "dbenv->open: %s\n", db_strerror(ret));
361 dbenv->close(dbenv, 0);
362 syslog(LOG_EMERG, "exit code %d\n", ret);
366 syslog(LOG_INFO, "Starting up DB\n");
368 for (i = 0; i < MAXCDB; ++i) {
370 /* Create a database handle */
371 ret = db_create(&dbp[i], dbenv, 0);
373 syslog(LOG_EMERG, "db_create: %s\n", db_strerror(ret));
374 syslog(LOG_EMERG, "exit code %d\n", ret);
379 /* Arbitrary names for our tables -- we reference them by
380 * number, so we don't have string names for them.
382 snprintf(dbfilename, sizeof dbfilename, "cdb.%02x", i);
384 ret = dbp[i]->open(dbp[i],
389 DB_CREATE | DB_AUTO_COMMIT | DB_THREAD,
393 syslog(LOG_EMERG, "db_open[%02x]: %s\n", i, db_strerror(ret));
395 syslog(LOG_EMERG, "You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
397 syslog(LOG_EMERG, "exit code %d\n", ret);
405 /* Make sure we own all the files, because in a few milliseconds
406 * we're going to drop root privs.
408 void cdb_chmod_data(void) {
411 char filename[PATH_MAX];
413 dp = opendir(ctdl_data_dir);
415 while (d = readdir(dp), d != NULL) {
416 if (d->d_name[0] != '.') {
417 snprintf(filename, sizeof filename,
418 "%s/%s", ctdl_data_dir, d->d_name);
419 syslog(LOG_DEBUG, "chmod(%s, 0600) returned %d\n",
420 filename, chmod(filename, 0600)
422 syslog(LOG_DEBUG, "chown(%s, CTDLUID, -1) returned %d\n",
423 filename, chown(filename, CTDLUID, (-1))
430 syslog(LOG_DEBUG, "open_databases() finished\n");
435 * Close all of the db database files we've opened. This can be done
436 * in a loop, since it's just a bunch of closes.
438 void close_databases(void)
443 if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
445 "txn_checkpoint: %s\n", db_strerror(ret));
448 /* print some statistics... */
450 dbenv->lock_stat_print(dbenv, DB_STAT_ALL);
453 /* close the tables */
454 for (a = 0; a < MAXCDB; ++a) {
455 syslog(LOG_INFO, "Closing database %02x\n", a);
456 ret = dbp[a]->close(dbp[a], 0);
458 syslog(LOG_EMERG, "db_close: %s\n", db_strerror(ret));
463 /* Close the handle. */
464 ret = dbenv->close(dbenv, 0);
466 syslog(LOG_EMERG, "DBENV->close: %s\n", db_strerror(ret));
472 * Decompress a database item if it was compressed on disk
474 void cdb_decompress_if_necessary(struct cdbdata *cdb)
476 static int magic = COMPRESS_MAGIC;
479 (cdb->ptr == NULL) ||
480 (cdb->len < sizeof(magic)) ||
481 (memcmp(cdb->ptr, &magic, sizeof(magic))))
484 /* At this point we know we're looking at a compressed item. */
486 struct CtdlCompressHeader zheader;
487 char *uncompressed_data;
488 char *compressed_data;
489 uLongf destLen, sourceLen;
492 memset(&zheader, 0, sizeof(struct CtdlCompressHeader));
493 cplen = sizeof(struct CtdlCompressHeader);
494 if (sizeof(struct CtdlCompressHeader) > cdb->len)
496 memcpy(&zheader, cdb->ptr, cplen);
498 compressed_data = cdb->ptr;
499 compressed_data += sizeof(struct CtdlCompressHeader);
501 sourceLen = (uLongf) zheader.compressed_len;
502 destLen = (uLongf) zheader.uncompressed_len;
503 uncompressed_data = malloc(zheader.uncompressed_len);
505 if (uncompress((Bytef *) uncompressed_data,
506 (uLongf *) & destLen,
507 (const Bytef *) compressed_data,
508 (uLong) sourceLen) != Z_OK) {
509 syslog(LOG_EMERG, "uncompress() error\n");
514 cdb->len = (size_t) destLen;
515 cdb->ptr = uncompressed_data;
521 * Store a piece of data. Returns 0 if the operation was successful. If a
522 * key already exists it should be overwritten.
524 int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
531 struct CtdlCompressHeader zheader;
532 char *compressed_data = NULL;
534 size_t buffer_len = 0;
537 memset(&dkey, 0, sizeof(DBT));
538 memset(&ddata, 0, sizeof(DBT));
540 /* no, we don't care for this error. */
543 ddata.size = cdatalen;
546 /* Only compress Visit records. Everything else is uncompressed. */
547 if (cdb == CDB_VISIT) {
549 zheader.magic = COMPRESS_MAGIC;
550 zheader.uncompressed_len = cdatalen;
551 buffer_len = ((cdatalen * 101) / 100) + 100
552 + sizeof(struct CtdlCompressHeader);
553 destLen = (uLongf) buffer_len;
554 compressed_data = malloc(buffer_len);
555 if (compress2((Bytef *) (compressed_data + sizeof(struct CtdlCompressHeader)),
556 &destLen, (Bytef *) cdata, (uLongf) cdatalen, 1) != Z_OK)
558 syslog(LOG_EMERG, "compress2() error\n");
561 zheader.compressed_len = (size_t) destLen;
562 memcpy(compressed_data, &zheader, sizeof(struct CtdlCompressHeader));
563 ddata.size = (size_t) (sizeof(struct CtdlCompressHeader) + zheader.compressed_len);
564 ddata.data = compressed_data;
567 if (TSD->tid != NULL) {
568 ret = dbp[cdb]->put(dbp[cdb], /* db */
569 TSD->tid, /* transaction ID */
574 syslog(LOG_EMERG, "cdb_store(%d): %s", cdb, db_strerror(ret));
578 free(compressed_data);
582 bailIfCursor(TSD->cursors, "attempt to write during r/o cursor");
587 if ((ret = dbp[cdb]->put(dbp[cdb], /* db */
588 tid, /* transaction ID */
592 if (ret == DB_LOCK_DEADLOCK) {
596 syslog(LOG_EMERG, "cdb_store(%d): %s", cdb, db_strerror(ret));
602 free(compressed_data);
612 * Delete a piece of data. Returns 0 if the operation was successful.
614 int cdb_delete(int cdb, void *key, int keylen)
621 memset(&dkey, 0, sizeof dkey);
625 if (TSD->tid != NULL) {
626 ret = dbp[cdb]->del(dbp[cdb], TSD->tid, &dkey, 0);
628 syslog(LOG_EMERG, "cdb_delete(%d): %s\n", cdb, db_strerror(ret));
629 if (ret != DB_NOTFOUND) {
634 bailIfCursor(TSD->cursors, "attempt to delete during r/o cursor");
639 if ((ret = dbp[cdb]->del(dbp[cdb], tid, &dkey, 0))
640 && ret != DB_NOTFOUND) {
641 if (ret == DB_LOCK_DEADLOCK) {
645 syslog(LOG_EMERG, "cdb_delete(%d): %s\n",
646 cdb, db_strerror(ret));
656 static DBC *localcursor(int cdb)
661 if (TSD->cursors[cdb] == NULL)
662 ret = dbp[cdb]->cursor(dbp[cdb], TSD->tid, &curs, 0);
664 ret = TSD->cursors[cdb]->c_dup(TSD->cursors[cdb], &curs, DB_POSITION);
667 syslog(LOG_EMERG, "localcursor: %s\n", db_strerror(ret));
676 * Fetch a piece of data. If not found, returns NULL. Otherwise, it returns
677 * a struct cdbdata which it is the caller's responsibility to free later on
678 * using the cdb_free() routine.
680 struct cdbdata *cdb_fetch(int cdb, const void *key, int keylen)
682 struct cdbdata *tempcdb;
686 memset(&dkey, 0, sizeof(DBT));
688 /* no we don't care about this error. */
691 if (TSD->tid != NULL) {
692 memset(&dret, 0, sizeof(DBT));
693 dret.flags = DB_DBT_MALLOC;
694 ret = dbp[cdb]->get(dbp[cdb], TSD->tid, &dkey, &dret, 0);
699 memset(&dret, 0, sizeof(DBT));
700 dret.flags = DB_DBT_MALLOC;
702 curs = localcursor(cdb);
704 ret = curs->c_get(curs, &dkey, &dret, DB_SET);
707 while (ret == DB_LOCK_DEADLOCK);
711 if ((ret != 0) && (ret != DB_NOTFOUND)) {
712 syslog(LOG_EMERG, "cdb_fetch(%d): %s\n", cdb, db_strerror(ret));
718 tempcdb = (struct cdbdata *) malloc(sizeof(struct cdbdata));
720 if (tempcdb == NULL) {
721 syslog(LOG_EMERG, "cdb_fetch: Cannot allocate memory for tempcdb\n");
723 return NULL; /* make it easier for static analysis... */
727 tempcdb->len = dret.size;
728 tempcdb->ptr = dret.data;
729 cdb_decompress_if_necessary(tempcdb);
736 * Free a cdbdata item.
738 * Note that we only free the 'ptr' portion if it is not NULL. This allows
739 * other code to assume ownership of that memory simply by storing the
740 * pointer elsewhere and then setting 'ptr' to NULL. cdb_free() will then
743 void cdb_free(struct cdbdata *cdb)
751 void cdb_close_cursor(int cdb)
753 if (TSD->cursors[cdb] != NULL) {
754 cclose(TSD->cursors[cdb]);
757 TSD->cursors[cdb] = NULL;
761 * Prepare for a sequential search of an entire database.
762 * (There is guaranteed to be no more than one traversal in
763 * progress per thread at any given time.)
765 void cdb_rewind(int cdb)
769 if (TSD->cursors[cdb] != NULL) {
771 "cdb_rewind: must close cursor on database %d before reopening.\n", cdb);
773 /* cclose(TSD->cursors[cdb]); */
777 * Now initialize the cursor
779 ret = dbp[cdb]->cursor(dbp[cdb], TSD->tid, &TSD->cursors[cdb], 0);
781 syslog(LOG_EMERG, "cdb_rewind: db_cursor: %s\n", db_strerror(ret));
788 * Fetch the next item in a sequential search. Returns a pointer to a
789 * cdbdata structure, or NULL if we've hit the end.
791 struct cdbdata *cdb_next_item(int cdb)
794 struct cdbdata *cdbret;
797 /* Initialize the key/data pair so the flags aren't set. */
798 memset(&key, 0, sizeof(key));
799 memset(&data, 0, sizeof(data));
800 data.flags = DB_DBT_MALLOC;
802 ret = TSD->cursors[cdb]->c_get(TSD->cursors[cdb], &key, &data, DB_NEXT);
805 if (ret != DB_NOTFOUND) {
806 syslog(LOG_EMERG, "cdb_next_item(%d): %s\n", cdb, db_strerror(ret));
809 cdb_close_cursor(cdb);
810 return NULL; /* presumably, end of file */
813 cdbret = (struct cdbdata *) malloc(sizeof(struct cdbdata));
814 cdbret->len = data.size;
815 cdbret->ptr = data.data;
816 cdb_decompress_if_necessary(cdbret);
824 * Transaction-based stuff. I'm writing this as I bake cookies...
827 void cdb_begin_transaction(void)
830 bailIfCursor(TSD->cursors, "can't begin transaction during r/o cursor");
832 if (TSD->tid != NULL) {
833 syslog(LOG_EMERG, "cdb_begin_transaction: ERROR: nested transaction\n");
840 void cdb_end_transaction(void)
844 for (i = 0; i < MAXCDB; i++)
845 if (TSD->cursors[i] != NULL) {
847 "cdb_end_transaction: WARNING: cursor %d still open at transaction end\n",
849 cclose(TSD->cursors[i]);
850 TSD->cursors[i] = NULL;
853 if (TSD->tid == NULL) {
855 "cdb_end_transaction: ERROR: txcommit(NULL) !!\n");
865 * Truncate (delete every record)
867 void cdb_trunc(int cdb)
873 if (TSD->tid != NULL) {
874 syslog(LOG_EMERG, "cdb_trunc must not be called in a transaction.");
877 bailIfCursor(TSD->cursors, "attempt to write during r/o cursor");
882 if ((ret = dbp[cdb]->truncate(dbp[cdb], /* db */
883 NULL, /* transaction ID */
884 &count, /* #rows deleted */
886 if (ret == DB_LOCK_DEADLOCK) {
890 syslog(LOG_EMERG, "cdb_truncate(%d): %s\n", cdb, db_strerror(ret));
892 syslog(LOG_EMERG, "You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
902 int SeentDebugEnabled = 0;
904 #define DBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (SeentDebugEnabled != 0))
905 #define SEENM_syslog(LEVEL, FORMAT) \
906 DBGLOG(LEVEL) syslog(LEVEL, \
907 "IO[%ld]CC[%ld] SEEN[%s][%d] " FORMAT, \
908 ioid, ccid, Facility, cType)
910 time_t CheckIfAlreadySeen(const char *Facility,
918 time_t InDBTimeStamp = 0;
920 struct cdbdata *cdbut;
924 SEENM_syslog(LOG_DEBUG, "Loading");
925 cdbut = cdb_fetch(CDB_USETABLE, SKEY(guid));
927 memcpy(&ut, cdbut->ptr,
928 ((cdbut->len > sizeof(struct UseTable)) ?
929 sizeof(struct UseTable) : cdbut->len));
930 InDBTimeStamp = ut.ut_timestamp;
932 if (InDBTimeStamp < antiexpire)
934 SEENM_syslog(LOG_DEBUG, "Found - Not expired.");
936 return InDBTimeStamp;
940 SEENM_syslog(LOG_DEBUG, "Found - Expired.");
941 InDBTimeStamp = ut.ut_timestamp;
947 SEENM_syslog(LOG_DEBUG, "not Found");
950 if (cType == eCheckExist)
951 return InDBTimeStamp;
954 memcpy(ut.ut_msgid, SKEY(guid));
955 ut.ut_timestamp = now;
957 SEENM_syslog(LOG_DEBUG, "Saving");
958 /* rewrite the record anyway, to update the timestamp */
959 cdb_store(CDB_USETABLE,
961 &ut, sizeof(struct UseTable) );
963 SEENM_syslog(LOG_DEBUG, "Done Saving");
964 return InDBTimeStamp;
968 void LogDebugEnableSeenEnable(const int n)
970 SeentDebugEnabled = n;
973 CTDL_MODULE_INIT(database)
977 CtdlRegisterDebugFlagHook(HKEY("SeenDebug"), LogDebugEnableSeenEnable, &SeentDebugEnabled);
980 /* return our module id for the log */