move cull to serv_syscmds
authorWilfried Goesgens <dothebart@citadel.org>
Sat, 14 Sep 2013 20:23:59 +0000 (22:23 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 14 Sep 2013 20:23:59 +0000 (22:23 +0200)
citadel/database.c
citadel/database.h
citadel/modules/ctdlproto/serv_syscmds.c

index 724ee0f941cb20f73cfc1f0609ed6837c8af4256..98ed9680e305e3ee0000ad2b7c110b86c914ac38 100644 (file)
@@ -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");
 }
 
 
index 88129b49d423e4d09ac725fb4b5d5c87f17877f8..7b3b844b90b9b25d16b2d9c58addab941981b88f 100644 (file)
@@ -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
index 75db7e88e0e6cd8d136fb29fc59465eac696007d..7bf9acab85621cb344d8307339100bfb3ae07ce2 100644 (file)
@@ -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";