X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fctdlproto%2Fserv_syscmds.c;h=7341ad238c0e6dc82225b18f56358b3a7fa26f60;hb=d424d048b75f6ad6ddb3c92d8d1cf868d63e303f;hp=7bf9acab85621cb344d8307339100bfb3ae07ce2;hpb=60e4aee68ed95e7ec91efcf7305f8daaf1193d75;p=citadel.git diff --git a/citadel/modules/ctdlproto/serv_syscmds.c b/citadel/modules/ctdlproto/serv_syscmds.c index 7bf9acab8..7341ad238 100644 --- a/citadel/modules/ctdlproto/serv_syscmds.c +++ b/citadel/modules/ctdlproto/serv_syscmds.c @@ -2,7 +2,7 @@ /* * Main source module for the Citadel server * - * Copyright (c) 1987-2011 by the citadel.org team + * Copyright (c) 1987-2018 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3. @@ -13,105 +13,11 @@ * GNU General Public License for more details. */ -#include "sysdep.h" -#include -#include #include -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#if HAVE_BACKTRACE -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include "citadel.h" -#include "server.h" -#include "sysdep_decls.h" -#include "threads.h" -#include "citserver.h" -#include "config.h" -#include "database.h" -#include "housekeeping.h" -#include "user_ops.h" -#include "msgbase.h" -#include "support.h" -#include "locate_host.h" -#include "room_ops.h" -#include "control.h" -#include "euidindex.h" -#include "context.h" -#include "svn_revision.h" -#include "ctdl_module.h" - -void cmd_log_get(char *argbuf) -{ - long HKLen; - const char *ch; - HashPos *Pos; - void *vptr; - - if (CtdlAccessCheck(ac_aide)) return; - - cprintf("%d Log modules enabled:\n", LISTING_FOLLOWS); - Pos = GetNewHashPos(LogDebugEntryTable, 0); - - while (GetNextHashPos(LogDebugEntryTable, Pos, &HKLen, &ch, &vptr)) { - LogDebugEntry *E = (LogDebugEntry*)vptr; - cprintf("%s|%d\n", ch, *E->LogP); - } - - DeleteHashPos(&Pos); - cprintf("000\n"); -} -void cmd_log_set(char *argbuf) -{ - void *vptr; - int lset; - int wlen; - char which[SIZ] = ""; - - if (CtdlAccessCheck(ac_aide)) return; - - wlen = extract_token(which, argbuf, 0, '|', sizeof(which)); - if (wlen < 0) wlen = 0; - lset = extract_int(argbuf, 1); - if (lset != 0) lset = 1; - if (GetHash(LogDebugEntryTable, which, wlen, &vptr) && - (vptr != NULL)) - { - LogDebugEntry *E = (LogDebugEntry*)vptr; - E->F(lset); - cprintf("%d %s|%d\n", CIT_OK, which, lset); - } - else { - cprintf("%d Log setting %s not known\n", - ERROR, which); - } -} +#include "serv_extensions.h" +#include "ctdl_module.h" /* @@ -173,16 +79,8 @@ void cmd_scdn(char *argbuf) if (CtdlAccessCheck(ac_aide)) return; new_state = extract_int(argbuf, 0); - if ((new_state == 2) || (new_state == 3)) - { + if ((new_state == 2) || (new_state == 3)) { restart_server = 1; - if (!running_as_daemon) - { - syslog(LOG_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n"); - Reply = "%d %d Warning, not running in deamon mode. maybe we will come up again, but don't lean on it.\n"; - state = ERROR; - } - restart_server = extract_int(argbuf, 0); new_state -= 2; } @@ -192,16 +90,6 @@ 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 */ @@ -210,14 +98,9 @@ void cmd_cull(char *argbuf) { CTDL_MODULE_INIT(syscmd) { if (!threading) { - CtdlRegisterProtoHook(cmd_log_get, "LOGP", "Print Log-parameters"); - CtdlRegisterProtoHook(cmd_log_set, "LOGS", "Set Log-parameters"); - 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";