Create app and app-ssl directories for new domains.

This commit is contained in:
Michael Hierweck 2014-09-01 18:04:31 +02:00
parent 90350b0ca0
commit a210317755
2 changed files with 4 additions and 9 deletions

View File

@ -26,14 +26,10 @@ import de.hsadmin.mods.user.UnixUser;
public class DomainProcessorFactory implements EntityProcessorFactory { public class DomainProcessorFactory implements EntityProcessorFactory {
private static final String[] DYNAMIC_STRUCTURE = new String[] { private static final String[] DOM_STRUCTURE = new String[] {
"htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "etc", "var" "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "app", "app-ssl", "etc", "var"
}; };
private static final String[] STATIC_STRUCTURE = new String[] {
"htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "etc", "var"
};
public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException { public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException {
String hiveName = entity.getHiveName(); String hiveName = entity.getHiveName();
Domain dom = (Domain) entity; Domain dom = (Domain) entity;
@ -210,7 +206,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
String domsDir = homeDir + "/doms"; String domsDir = homeDir + "/doms";
String userName = domUser.getName(); String userName = domUser.getName();
String domainDir = domsDir + "/" + dom.getName(); String domainDir = domsDir + "/" + dom.getName();
String[] subDirs = dom.isDynamic() ? DYNAMIC_STRUCTURE : STATIC_STRUCTURE;
String httpdRights = ""; String httpdRights = "";
if (pacName != userName) { if (pacName != userName) {
httpdRights = httpdRights =
@ -227,7 +222,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
"chown " + userName + ":httpd " + domainDir "chown " + userName + ":httpd " + domainDir
); );
CompoundProcessor domDirsProcessor = new CompoundProcessor(mkDomainDirProzessor); CompoundProcessor domDirsProcessor = new CompoundProcessor(mkDomainDirProzessor);
for (String subDir : subDirs) { for (String subDir : DOM_STRUCTURE) {
domDirsProcessor.appendProcessor(new ShellProcessor( domDirsProcessor.appendProcessor(new ShellProcessor(
"mkdir --mode=755 --parents " + domainDir + "/" + subDir + " && " + "mkdir --mode=755 --parents " + domainDir + "/" + subDir + " && " +
"chown " + userName + ":" + pacName + " " + domainDir + "/" + subDir "chown " + userName + ":" + pacName + " " + domainDir + "/" + subDir

View File

@ -67,8 +67,8 @@
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary] RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d RewriteCond /home/doms/${dom.name}/subs/#[[${tolower:%1} ]]# !-d
RewriteRule ^(.*) - [redirect=404,last] RewriteRule ^(.*) - [redirect=404,last]
#end #end
#if( ${dynamicWeb} ) #if( ${dynamicWeb} )
AddType application/x-httpd-php .php .php5 .php4 .php3 AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub Action application/x-httpd-php /fastcgi-bin/phpstub