apache: fix phpVersion action
[hcoop/domtool2.git] / src / plugins / apache.sml
index f21d3ac..59e96b3 100644 (file)
@@ -474,6 +474,8 @@ fun vhostPost () = (!post ();
 val php_version = fn (EVar "php56", _) => SOME 56
                    | (EVar "php72", _) => SOME 72
                   | (EVar "php73", _) => SOME 73
+                  | (EVar "php74", _) => SOME 74
+                  | (EVar "php80", _) => SOME 80
                   | _ => NONE
 
 fun vhostBody (env, makeFullHost) =
@@ -560,7 +562,7 @@ fun vhostBody (env, makeFullHost) =
                                  else
                                      ();
 
-                                 TextIO.output (file, "\n\tDAVLockDB /var/lock/apache2/dav/");
+                                 TextIO.output (file, "\n\tDAVLockDB /var/local/domtool/apache2/dav/");
                                  TextIO.output (file, user);
                                  TextIO.output (file, "/DAVLock");
 
@@ -664,17 +666,26 @@ fun checkExpires () =
        (write "\tExpiresActive on\n";
         expiresEnabled := true)
 
-val () = Env.action_three "localProxyRewrite"
-        ("from", Env.string, "to", Env.string, "port", Env.int)
-        (fn (from, to, port) =>
+val () = Env.action_four "proxyRewrite"
+        ("from", Env.string, "to", Env.string, "tohost", Env.string, "flags", Env.list flag)
+        (fn (from, to, tohost, flags) =>
             (checkRewrite ();
              write "\tRewriteRule\t\"";
              write from;
-             write "\"\thttp://localhost:";
-             write (Int.toString port);
-             write "/";
+             write "\"\t\"";
+             write tohost;
+             write "/"; (* ensure rewrite rule can't change port *)
              write to;
-             write " [P]\n"))
+             write "\"";
+             write " [P";
+             case flags of
+                 [] => ()
+               | flag::rest => (write ",";
+                                write flag;
+                                app (fn flag => (write ",";
+                                                 write flag)) rest);
+
+             write "]\n"))
 
 val () = Env.action_four "expiresByType"
         ("mime", Env.string, "base", interval_base, "num", Env.int, "inter", interval)
@@ -1197,13 +1208,16 @@ val () = Env.action_one "diskCache"
 val () = Env.action_one "phpVersion"
         ("version", php_version)
         (fn version => (write "\tAddHandler fcgid-script .php .phtml\n";
-                             (* FIXME: only set kerberos wrapper of waklog is on *)
-                             (* won't be trivial, since we don't have access to node here *)
-                             write "\n\tFcgidWrapper \"";
-                             write (Config.Apache.fastCgiWrapperOf (Domain.getUser ()));
-                             write " ";
-                             write (Config.Apache.phpFastCgiWrapper version);
-                             write "\" .php .phtml\n"))
+                        (* FIXME: only set kerberos wrapper of waklog is on *)
+                        (* won't be trivial, since we don't have access to node here *)
+                        app (fn ext => (write "\n\tFcgidWrapper \"";
+                                        write (Config.Apache.fastCgiWrapperOf (Domain.getUser ()));
+                                        write " ";
+                                        write (Config.Apache.phpFastCgiWrapper version);
+                                        write "\" ";
+                                        write ext;
+                                        write "\n"))
+                            [".php", ".phtml"]))
 
 val () = Env.action_two "addType"
         ("mime type", Env.string, "extension", Env.string)