val _ = Env.type_one "web_node"
Env.string
(fn node =>
- List.exists (fn x => x = node) Config.Apache.webNodes_all
+ 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))
+ andalso List.exists (fn (x, _) => x = node) Config.Apache.webNodes_admin))
val _ = Env.registerFunction ("web_node_to_node",
fn [e] => SOME e
before TextIO.closeIn inf
end handle _ => NONE
+val webNodes_full = Config.Apache.webNodes_all @ Config.Apache.webNodes_admin
+
+fun isVersion1 node =
+ List.exists (fn x => x = (node, true)) webNodes_full
+
+fun imVersion1 () = isVersion1 (Slave.hostname ())
+
+fun down () = if imVersion1 () then Config.Apache.down1 else Config.Apache.down
+fun undown () = if imVersion1 () then Config.Apache.undown1 else Config.Apache.undown
+fun reload () = if imVersion1 () then Config.Apache.reload1 else Config.Apache.reload
+
val () = Slave.registerFileHandler (fn fs =>
let
val spl = OS.Path.splitDirFile (#file fs)
(if !logDeleted then
()
else
- (ignore (OS.Process.system Config.Apache.down);
+ (ignore (OS.Process.system (down ()));
logDeleted := true);
ignore (OS.Process.system (Config.rm
^ " -rf "
if !logDeleted then
()
else
- (ignore (OS.Process.system Config.Apache.down);
+ (ignore (OS.Process.system (down ()));
logDeleted := true);
ignore (OS.Process.system (Config.rm
^ " -rf "
val () = Slave.registerPostHandler
(fn () =>
(if !vhostsChanged then
- Slave.shellF ([if !logDeleted then Config.Apache.undown else Config.Apache.reload],
+ Slave.shellF ([if !logDeleted then undown () else reload ()],
fn cl => "Error reloading Apache with " ^ cl)
else
()))
TextIO.output (file, "/");
TextIO.output (file, vhostId);
TextIO.output (file, "/access.log combined\n");
+ TextIO.output (file, "\tServerName ");
+ TextIO.output (file, fullHost);
+ if suexec then
+ if isVersion1 node then
+ (TextIO.output (file, "\n\tUser ");
+ TextIO.output (file, user);
+ TextIO.output (file, "\n\tGroup ");
+ TextIO.output (file, group))
+ else
+ (TextIO.output (file, "\n\tSuexecUserGroup ");
+ TextIO.output (file, user);
+ TextIO.output (file, " ");
+ TextIO.output (file, group))
+ else
+ ();
(Domain.homedirOf user ^ "/apache/log/"
^ node ^ "/" ^ vhostId, file)
end)
nodes;
- write "\tServerName ";
- write fullHost;
- if suexec then
- (write "\n\tSuexecUserGroup ";
- write user;
- write " ";
- write group)
- else
- ();
write "\n\tDocumentRoot ";
write docroot;
write "\n\tServerAdmin ";