apache: pass script to fastcgi wrapper
[hcoop/domtool2.git] / src / plugins / apache.sml
index c4b47af..b959219 100644 (file)
@@ -559,11 +559,15 @@ fun vhostBody (env, makeFullHost) =
                                  then
                                      (* fastcgi php 5.6 since 6 doesn't exist *)
                                      (TextIO.output (file, "\n\tAddHandler fcgid-script .php .phtml");
-                                      TextIO.output (file, "\n\tFcgidWrapper \"");
-                                      TextIO.output (file, Config.Apache.fastCgiWrapperOf user);
-                                      TextIO.output (file, " ");
-                                      TextIO.output (file, Config.Apache.phpFastCgiWrapper);
-                                      TextIO.output (file, "\""))
+                                      (* FIXME: only set kerberos wrapper of waklog is on *)
+                                      map (fn ext => (TextIO.output (file, "\n\tFcgidWrapper \"");
+                                                      TextIO.output (file, Config.Apache.fastCgiWrapperOf user);
+                                                      TextIO.output (file, " ");
+                                                      TextIO.output (file, Config.Apache.phpFastCgiWrapper);
+                                                      TextIO.output (file, "\" ");
+                                                      TextIO.output (file, ext)))
+                                          [".php", ".phtml"];
+                                      ())
                                  else
                                      (TextIO.output (file, "\n\tAddHandler x-httpd-php");
                                       TextIO.output (file, Int.toString php);
@@ -783,6 +787,27 @@ val () = Env.action_two "scriptAlias"
              write to;
              write "\n"))
 
+val () = Env.action_two "fastScriptAlias"
+        ("from", Env.string, "to", Env.string)
+        (fn (from, to) =>
+            (write "\tAlias\t";
+             write from;
+             write " ";
+             write to;
+             write "\n";
+
+             write "\t<Location ";
+             write from;
+             write ">\n";
+             write "\t\tSetHandler fcgid-script\n";
+             (* FIXME: only set kerberos wrapper of waklog is on *)
+             write "\t\tFcgidWrapper \"";
+             write (Config.Apache.fastCgiWrapperOf (Domain.getUser ()));
+             write " ";
+             write to;
+             write "\"\n";
+             write "\t</Location>\n"))
+
 val () = Env.action_two "errorDocument"
         ("code", Env.string, "handler", Env.string)
         (fn (code, handler) =>
@@ -1112,9 +1137,20 @@ val () = Env.action_one "diskCache"
 
 val () = Env.action_one "phpVersion"
         ("version", php_version)
-        (fn version => (write "\tAddHandler x-httpd-php";
-                        write (Int.toString version);
-                        write " .php .phtml\n"))
+        (fn version => (if version = 6
+                        then
+                            (* fastcgi php 5.6 since 6 doesn't exist *)
+                            (write "\tAddHandler fcgid-script .php .phtml\n";
+                             (* FIXME: only set kerberos wrapper of waklog is on *)
+                             write "\n\tFcgidWrapper \"";
+                             write (Config.Apache.fastCgiWrapperOf (Domain.getUser ()));
+                             write " ";
+                             write Config.Apache.phpFastCgiWrapper;
+                             write "\" .php .phtml\n")
+                        else
+                            (write "\tAddHandler x-httpd-php";
+                             write (Int.toString version);
+                             write " .php .phtml\n")))
 
 val () = Env.action_two "addType"
         ("mime type", Env.string, "extension", Env.string)