Make Webalizer the capitalization pedant happy
[hcoop/domtool2.git] / src / plugins / webalizer.sml
index 2237fe5..b344165 100644 (file)
@@ -32,11 +32,7 @@ val () = Apache.registerPre
                                                                   name = id ^ ".wbl"}
                                   in
                                       TextIO.output (fd, "LogFile\t");
                                                                   name = id ^ ".wbl"}
                                   in
                                       TextIO.output (fd, "LogFile\t");
-                                      TextIO.output (fd, Config.homeBase);
-                                      TextIO.output (fd, "/apache/log/");
-                                      TextIO.output (fd, node);
-                                      TextIO.output (fd, "/");
-                                      TextIO.output (fd, hostname);
+                                      TextIO.output (fd, Apache.logDir {user = user, node = node, vhostId = hostname});
                                       TextIO.output (fd, "/access.log\nOutputDir\t");
                                       TextIO.output (fd, Config.Webalizer.outputDir);
                                       TextIO.output (fd, "/");
                                       TextIO.output (fd, "/access.log\nOutputDir\t");
                                       TextIO.output (fd, Config.Webalizer.outputDir);
                                       TextIO.output (fd, "/");
@@ -49,7 +45,7 @@ val () = Apache.registerPre
             in
                 files := fds;
                 write := (fn s => app (fn fd => TextIO.output (fd, s)) fds);
             in
                 files := fds;
                 write := (fn s => app (fn fd => TextIO.output (fd, s)) fds);
-                !write "Hostname\t";
+                !write "HostName\t";
                 !write hostname;
                 !write "\nHideSite\t";
                 !write hostname;
                 !write hostname;
                 !write "\nHideSite\t";
                 !write hostname;
@@ -81,12 +77,16 @@ val () = Slave.registerFileHandler (fn fs =>
                                                                                ^ " -f "
                                                                                ^ Config.Webalizer.configDir
                                                                                ^ "/"
                                                                                ^ " -f "
                                                                                ^ Config.Webalizer.configDir
                                                                                ^ "/"
+                                                                               ^ Slave.hostname ()
+                                                                               ^ "/"
                                                                                ^ base
                                                                                ^ ".conf"));
                                                     ignore (OS.Process.system (Config.rm
                                                                                ^ " -rf "
                                                                                ^ Config.Webalizer.outputDir
                                                                                ^ "/"
                                                                                ^ base
                                                                                ^ ".conf"));
                                                     ignore (OS.Process.system (Config.rm
                                                                                ^ " -rf "
                                                                                ^ Config.Webalizer.outputDir
                                                                                ^ "/"
+                                                                               ^ Slave.hostname ()
+                                                                               ^ "/"
                                                                                ^ base)))
                                                  | _ =>
                                                    (ignore (OS.Process.system (Config.cp
                                                                                ^ base)))
                                                  | _ =>
                                                    (ignore (OS.Process.system (Config.cp
@@ -95,10 +95,12 @@ val () = Slave.registerFileHandler (fn fs =>
                                                                                ^ " "
                                                                                ^ Config.Webalizer.configDir
                                                                                ^ "/"
                                                                                ^ " "
                                                                                ^ Config.Webalizer.configDir
                                                                                ^ "/"
+                                                                               ^ Slave.hostname ()
+                                                                               ^ "/"
                                                                                ^ base
                                                                                ^ ".conf"));
                                                     let
                                                                                ^ base
                                                                                ^ ".conf"));
                                                     let
-                                                        val dir = Config.Webalizer.outputDir ^ "/" ^ base
+                                                        val dir = Config.Webalizer.outputDir ^ "/" ^ Slave.hostname () ^ "/" ^ base
                                                     in
                                                         if Posix.FileSys.access (dir, []) then
                                                             ()
                                                     in
                                                         if Posix.FileSys.access (dir, []) then
                                                             ()
@@ -108,4 +110,10 @@ val () = Slave.registerFileHandler (fn fs =>
                                             | _ => ()
                                       end)
 
                                             | _ => ()
                                       end)
 
+val () = Domain.registerResetLocal (fn () =>
+                                      app (fn (node, _) =>
+                                              ignore (OS.Process.system (Config.rm ^ " -rf "
+                                                                         ^ Config.Webalizer.configDir ^ "/"
+                                                                         ^ node ^ "/*"))) Config.nodeIps)
+
 end
 end