From: Wilfried Goesgens Date: Sat, 14 Sep 2013 20:23:59 +0000 (+0200) Subject: move cull to serv_syscmds X-Git-Tag: v9.01~253 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=60e4aee68ed95e7ec91efcf7305f8daaf1193d75 move cull to serv_syscmds --- diff --git a/citadel/database.c b/citadel/database.c index 724ee0f94..98ed9680e 100644 --- a/citadel/database.c +++ b/citadel/database.c @@ -185,7 +185,7 @@ void cdb_check_handles(void) /* * Cull the database logs */ -static void cdb_cull_logs(void) +void cdb_cull_logs(void) { u_int32_t flags; int ret; @@ -221,15 +221,6 @@ static void cdb_cull_logs(void) } } -/* - * Manually initiate log file cull. - */ -void cmd_cull(char *argbuf) { - if (CtdlAccessCheck(ac_internal)) return; - cdb_cull_logs(); - cprintf("%d Database log file cull completed.\n", CIT_OK); -} - /* * Request a checkpoint of the database. Called once per minute by the thread manager. @@ -437,7 +428,6 @@ void cdb_chmod_data(void) { } syslog(LOG_DEBUG, "open_databases() finished\n"); - CtdlRegisterProtoHook(cmd_cull, "CULL", "Cull database logs"); } diff --git a/citadel/database.h b/citadel/database.h index 88129b49d..7b3b844b9 100644 --- a/citadel/database.h +++ b/citadel/database.h @@ -33,6 +33,8 @@ void *checkpoint_thread(void *arg); void cdb_chmod_data(void); void cdb_checkpoint(void); void check_handles(void *arg); +void cdb_cull_logs(void); + /* * Database records beginning with this magic number are assumed to diff --git a/citadel/modules/ctdlproto/serv_syscmds.c b/citadel/modules/ctdlproto/serv_syscmds.c index 75db7e88e..7bf9acab8 100644 --- a/citadel/modules/ctdlproto/serv_syscmds.c +++ b/citadel/modules/ctdlproto/serv_syscmds.c @@ -192,6 +192,16 @@ void cmd_scdn(char *argbuf) cprintf(Reply, state, ScheduledShutdown); } +/* + * Manually initiate log file cull. + */ +void cmd_cull(char *argbuf) { + if (CtdlAccessCheck(ac_internal)) return; + cdb_cull_logs(); + cprintf("%d Database log file cull completed.\n", CIT_OK); +} + + /*****************************************************************************/ /* MODULE INITIALIZATION STUFF */ @@ -206,6 +216,8 @@ CTDL_MODULE_INIT(syscmd) CtdlRegisterProtoHook(cmd_down, "DOWN", "perform a server shutdown"); CtdlRegisterProtoHook(cmd_halt, "HALT", "halt the server without exiting the server process"); CtdlRegisterProtoHook(cmd_scdn, "SCDN", "schedule or cancel a server shutdown"); + + CtdlRegisterProtoHook(cmd_cull, "CULL", "Cull database logs"); } /* return our id for the Log */ return "syscmd";