X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/c17d0537db6e55a6b2bbd1a459542a5fbb44a68f..e9f528ab975ac28c16b2c370e69206a48f584d78:/src/plugins/apache.sml diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index 4e07e4e..f36bfa4 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -22,12 +22,14 @@ structure Apache :> APACHE = struct open Ast +fun webNode node = + List.exists (fn (x, _) => x = node) Config.Apache.webNodes_all + orelse (Domain.hasPriv "www" + andalso List.exists (fn (x, _) => x = node) Config.Apache.webNodes_admin) + val _ = Env.type_one "web_node" Env.string - (fn node => - List.exists (fn (x, _) => x = node) Config.Apache.webNodes_all - orelse (Domain.hasPriv "www" - andalso List.exists (fn (x, _) => x = node) Config.Apache.webNodes_admin)) + webNode val _ = Env.registerFunction ("web_node_to_node", fn [e] => SOME e @@ -256,10 +258,12 @@ val () = Slave.registerFileHandler (fn fs => file = #file spl} val user = findVhostUser (#file fs) - val oldUser = findVhostUser realVhostFile + val oldUser = case #action fs of + Slave.Delete false => user + | _ => findVhostUser realVhostFile in if (oldUser = NONE andalso #action fs <> Slave.Add) - orelse (user = NONE andalso #action fs <> Slave.Delete) then + orelse (user = NONE andalso not (Slave.isDelete (#action fs))) then print ("Can't find user in " ^ #file fs ^ " or " ^ realVhostFile ^ "! Taking no action.\n") else let @@ -281,7 +285,7 @@ val () = Slave.registerFileHandler (fn fs => in vhostsChanged := true; case #action fs of - Slave.Delete => + Slave.Delete _ => let val ldir = realLogDir oldUser in @@ -379,6 +383,9 @@ fun registerPost f = post := (fn () => (old (); f ())) end +fun doPre x = !pre x +fun doPost () = !post () + val aliaser = ref (fn _ : string => ()) fun registerAliaser f = let