| | |
| | | |
| | | public class DomainProcessorFactory implements EntityProcessorFactory { |
| | | |
| | | private static final String[] DYNAMIC_STRUCTURE = new String[] { |
| | | "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "etc", "var" |
| | | 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", "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 { |
| | | String hiveName = entity.getHiveName(); |
| | | Domain dom = (Domain) entity; |
| | |
| | | String domsDir = homeDir + "/doms"; |
| | | String userName = domUser.getName(); |
| | | String domainDir = domsDir + "/" + dom.getName(); |
| | | String[] subDirs = dom.isDynamic() ? DYNAMIC_STRUCTURE : STATIC_STRUCTURE; |
| | | String httpdRights = ""; |
| | | if (pacName != userName) { |
| | | httpdRights = |
| | |
| | | "chown " + userName + ":httpd " + domainDir |
| | | ); |
| | | CompoundProcessor domDirsProcessor = new CompoundProcessor(mkDomainDirProzessor); |
| | | for (String subDir : subDirs) { |
| | | for (String subDir : DOM_STRUCTURE) { |
| | | domDirsProcessor.appendProcessor(new ShellProcessor( |
| | | "mkdir --mode=755 --parents " + domainDir + "/" + subDir + " && " + |
| | | "chown " + userName + ":" + pacName + " " + domainDir + "/" + subDir |