From c3f64af2df2ffd04ec73a6a9d43dd87c026864bd Mon Sep 17 00:00:00 2001 From: Unbit Date: Sun, 22 Dec 2013 11:14:52 +0100 Subject: [PATCH] implemented private hooks --- core/hooks.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/hooks.c b/core/hooks.c index 042006a1..9184b091 100644 --- a/core/hooks.c +++ b/core/hooks.c @@ -486,14 +486,26 @@ void uwsgi_hooks_run(struct uwsgi_string_list *l, char *phase, int fatal) { exit(1); } *colon = 0; - struct uwsgi_hook *uh = uwsgi_hook_by_name(usl->value); + int private = 0; + char *action = usl->value; + // private hook ? + if (action[0] == '!') { + action++; + private = 1; + } + struct uwsgi_hook *uh = uwsgi_hook_by_name(action); if (!uh) { - uwsgi_log("hook not found: %s\n", usl->value); + uwsgi_log("hook action not found: %s\n", action); exit(1); } *colon = ':'; - uwsgi_log("running \"%s\" (%s)...\n", usl->value, phase); + if (private) { + uwsgi_log("running --- PRIVATE HOOK --- (%s)...\n", phase); + } + else { + uwsgi_log("running \"%s\" (%s)...\n", usl->value, phase); + } int ret = uh->func(colon+1); if (fatal && ret != 0) {