2010-10-05 21:42:07 +02:00
|
|
|
package de.hsadmin.mods.dom;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import javax.persistence.EntityManager;
|
|
|
|
import javax.persistence.Query;
|
|
|
|
|
|
|
|
import de.hsadmin.core.model.AbstractEntity;
|
|
|
|
import de.hsadmin.core.qserv.CompoundProcessor;
|
|
|
|
import de.hsadmin.core.qserv.CopyFileProcessor;
|
|
|
|
import de.hsadmin.core.qserv.CreateFileProcessor;
|
|
|
|
import de.hsadmin.core.qserv.EntityProcessorFactory;
|
|
|
|
import de.hsadmin.core.qserv.Processor;
|
|
|
|
import de.hsadmin.core.qserv.ProcessorException;
|
|
|
|
import de.hsadmin.core.qserv.ShellProcessor;
|
|
|
|
import de.hsadmin.core.qserv.TemplateProcessor;
|
|
|
|
import de.hsadmin.core.qserv.WaitingTasksProcessor;
|
|
|
|
import de.hsadmin.mods.email.EMailAddress;
|
|
|
|
import de.hsadmin.mods.email.EMailAddressProcessorFactory;
|
2011-07-20 14:11:43 +02:00
|
|
|
import de.hsadmin.mods.pac.INetAddress;
|
2010-10-05 21:42:07 +02:00
|
|
|
import de.hsadmin.mods.pac.Pac;
|
|
|
|
import de.hsadmin.mods.user.UnixUser;
|
|
|
|
|
|
|
|
public class DomainProcessorFactory implements EntityProcessorFactory {
|
|
|
|
|
2011-08-03 19:05:20 +02:00
|
|
|
private static final String[] DW_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[] SW_STRUCTURE = new String[] { "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "etc", "var" };
|
|
|
|
|
2010-10-05 21:42:07 +02:00
|
|
|
public <T extends AbstractEntity> Processor createCreateProcessor(EntityManager em, T entity) throws ProcessorException {
|
|
|
|
String hiveName = entity.getHiveName();
|
|
|
|
Domain dom = (Domain) entity;
|
|
|
|
UnixUser domUser = dom.getUser();
|
|
|
|
Pac pac = domUser.getPac();
|
2011-07-15 15:45:37 +02:00
|
|
|
String pacName = pac.getName();
|
2010-10-05 21:42:07 +02:00
|
|
|
String domName = dom.getName();
|
|
|
|
Map<String, String> templateVars = new HashMap<String, String>();
|
|
|
|
templateVars.put("SIO", Long.toString(System.currentTimeMillis()/1000L));
|
2011-07-15 15:45:37 +02:00
|
|
|
templateVars.put("PAC", pacName);
|
|
|
|
templateVars.put("HIVE", pac.getHiveName());
|
2010-10-05 21:42:07 +02:00
|
|
|
templateVars.put("DOM_HOSTNAME", domName);
|
2011-07-15 15:45:37 +02:00
|
|
|
templateVars.put("DOM_USERNAME", domUser.getName());
|
|
|
|
templateVars.put("PAC_HOSTNAME", pacName + ".hostsharing.net");
|
2011-07-20 14:11:43 +02:00
|
|
|
templateVars.put("DOM_IPNUMBER", getCurrentIPAddress(pac));
|
|
|
|
templateVars.put("DOM_IPNUMBEREX", getOldIPAddress(pac));
|
|
|
|
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(createHiveDNSSetupProcessor(domName, templateVars));
|
|
|
|
mainProcessor.appendProcessor(hiveName, createHiveEMailSetupProcessor(em, domName), "Setup EMail");
|
|
|
|
String hiveInetAddr = pac.getHive().getInetAddr().getInetAddr();
|
|
|
|
for (String queueName : new String[] { "dns1", "dns2", "dns3" }) {
|
|
|
|
mainProcessor.appendProcessor(queueName, createDNSServerSetupProcessor(domName, hiveInetAddr), queueName + ".hostsharing.net");
|
|
|
|
}
|
|
|
|
for (String queueName : new String[] { "mail1", "mail2", "mail3" }) {
|
|
|
|
mainProcessor.appendProcessor(queueName, createMailinSetupProcessor(domName, pac), queueName + ".hostsharing.net");
|
|
|
|
}
|
|
|
|
templateVars = new HashMap<String, String>();
|
|
|
|
templateVars.put("PAC", pacName);
|
|
|
|
templateVars.put("HIVE", pac.getHiveName());
|
|
|
|
templateVars.put("DOM_HOSTNAME", domName);
|
|
|
|
templateVars.put("DOM_USERNAME", domUser.getName());
|
|
|
|
templateVars.put("PAC_HOSTNAME", pacName + ".hostsharing.net");
|
|
|
|
templateVars.put("DOM_IPNUMBER", getCurrentIPAddress(pac));
|
|
|
|
templateVars.put("DOM_IPNUMBEREX", getOldIPAddress(pac));
|
|
|
|
templateVars.put("DOMAIN", domName);
|
|
|
|
templateVars.put("USER_NAME", domUser.getComment());
|
|
|
|
mainProcessor.appendProcessor(hiveName, createApacheVHostSetupProcessor(dom, templateVars), "Setup Apache VHost");
|
2011-10-28 15:28:19 +02:00
|
|
|
if (dom.isPacDomain()) {
|
|
|
|
mainProcessor.appendProcessor(hiveName, createMovePacDomainContent(em, dom), "Move pac domain content");
|
|
|
|
}
|
2011-07-20 14:11:43 +02:00
|
|
|
return mainProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity) throws ProcessorException {
|
|
|
|
throw new ProcessorException("domain.update not implemented");
|
|
|
|
}
|
|
|
|
|
|
|
|
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) {
|
|
|
|
Domain dom = (Domain) entity;
|
|
|
|
String domName = dom.getName();
|
|
|
|
WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(
|
|
|
|
new CompoundProcessor(
|
|
|
|
createHiveEMailRemoveProcessor(domName),
|
|
|
|
createHiveDNSRemoveProcessor(domName)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
for (String queueName : new String[] { "dns1", "dns2", "dns3" }) {
|
|
|
|
mainProcessor.appendProcessor(queueName, createDNSServerRemoveProcessor(domName), queueName + ".hostsharing.net");
|
|
|
|
}
|
|
|
|
for (String queueName : new String[] { "mail1", "mail2", "mail3" }) {
|
|
|
|
mainProcessor.appendProcessor(queueName, createMailinDeleteProcessor(domName), queueName + ".hostsharing.net");
|
|
|
|
}
|
|
|
|
mainProcessor.appendProcessor(dom.getHiveName(), createApacheVHostDeleteProcessor(dom), "remove apache vhost");
|
|
|
|
return mainProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private Processor createHiveDNSSetupProcessor(String domName, Map<String, String> templateVars)
|
|
|
|
throws ProcessorException {
|
|
|
|
String zonefileTargetPath = "/etc/bind/pri." + domName;
|
2010-10-05 21:42:07 +02:00
|
|
|
Processor zonefileTemplateProcessor =
|
|
|
|
new TemplateProcessor("/de/hsadmin/mods/dom/zonefile.jtpl", templateVars, zonefileTargetPath, false);
|
|
|
|
Processor zonefileACLProcessor =
|
|
|
|
new ShellProcessor("chown root:bind " + zonefileTargetPath + " && chmod 644 " + zonefileTargetPath);
|
|
|
|
Processor prizonesFileProcessor =
|
|
|
|
new ShellProcessor("echo 'zone \"" + domName + "\" { type master; file \"pri." + domName + "\"; };' >>/etc/bind/named.pri-zones" +
|
|
|
|
" && sort /etc/bind/named.pri-zones | uniq >/etc/bind/named.pri-zones.tmp" +
|
|
|
|
" && mv /etc/bind/named.pri-zones.tmp /etc/bind/named.pri-zones");
|
2011-05-19 18:22:56 +02:00
|
|
|
Processor dnsReloadProcessor = new ShellProcessor("invoke-rc.d bind9 reload");
|
2010-10-05 21:42:07 +02:00
|
|
|
Processor dnsSetupProcessor =
|
|
|
|
new CompoundProcessor(zonefileTemplateProcessor, zonefileACLProcessor, prizonesFileProcessor, dnsReloadProcessor);
|
2011-07-20 14:11:43 +02:00
|
|
|
return dnsSetupProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private ShellProcessor createHiveDNSRemoveProcessor(String domName) {
|
|
|
|
return new ShellProcessor("grep -v '\"pri." + domName + "\"' /etc/bind/named.pri-zones > /etc/bind/named.pri-zones.tmp" +
|
|
|
|
" && mv /etc/bind/named.pri-zones.tmp /etc/bind/named.pri-zones" +
|
|
|
|
" && rm /etc/bind/pri." + domName +
|
|
|
|
" && invoke-rc.d bind9 reload");
|
|
|
|
}
|
|
|
|
|
|
|
|
private CompoundProcessor createHiveEMailSetupProcessor(EntityManager em, String domName) {
|
|
|
|
EMailAddressProcessorFactory eMailAddressProcessorFactory = new EMailAddressProcessorFactory();
|
2010-10-05 21:42:07 +02:00
|
|
|
CompoundProcessor emailAdrProcessor = new CompoundProcessor();
|
2011-07-20 14:11:43 +02:00
|
|
|
Query query = em.createQuery(
|
|
|
|
"SELECT adr FROM " +
|
|
|
|
EMailAddress.class.getAnnotation(javax.persistence.Entity.class).name() + " adr " +
|
|
|
|
"WHERE adr.domain.name='" + domName + "'");
|
2010-10-05 21:42:07 +02:00
|
|
|
List<?> resultList = query.getResultList();
|
|
|
|
for (Object obj : resultList) {
|
|
|
|
EMailAddress eMailAddress = (EMailAddress) obj;
|
|
|
|
emailAdrProcessor.appendProcessor(eMailAddressProcessorFactory.createCreateProcessor(em, eMailAddress));
|
|
|
|
}
|
2011-07-20 14:11:43 +02:00
|
|
|
return emailAdrProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private ShellProcessor createHiveEMailRemoveProcessor(String domName) {
|
|
|
|
return new ShellProcessor(
|
|
|
|
"for KEY in $(postmap -s /etc/postfix/virtual|grep '@" + domName + "\\s'|cut -f1); " +
|
|
|
|
"do postmap -d $KEY /etc/postfix/virtual; done");
|
|
|
|
}
|
|
|
|
|
|
|
|
private Processor createDNSServerSetupProcessor(String domName,
|
|
|
|
String hiveInetAddr) {
|
|
|
|
Processor seczonesFileProcessor;
|
|
|
|
seczonesFileProcessor =
|
|
|
|
new ShellProcessor("echo 'zone \"" + domName + "\" { type slave; file \"sec." + domName + "\"; masters { " + hiveInetAddr + "; }; };' >>/etc/bind/named-hsh.conf" +
|
|
|
|
" && sort /etc/bind/named-hsh.conf | uniq >/etc/bind/named-hsh.conf.tmp" +
|
|
|
|
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
|
|
|
|
" && invoke-rc.d bind9 reload");
|
|
|
|
return seczonesFileProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private Processor createDNSServerRemoveProcessor(String domName) {
|
|
|
|
return new ShellProcessor("grep -v '\"sec." + domName + "\"' /etc/bind/named-hsh.conf >/etc/bind/named-hsh.conf.tmp" +
|
2011-10-21 14:46:13 +02:00
|
|
|
// TODO sed -e'/sec.abc.example.com/d' -i /etc/bind/named-hsh.conf
|
2011-07-20 14:11:43 +02:00
|
|
|
" && mv /etc/bind/named-hsh.conf.tmp /etc/bind/named-hsh.conf" +
|
|
|
|
" && rm /var/cache/bind/sec." + domName +
|
|
|
|
" && invoke-rc.d bind9 reload");
|
|
|
|
}
|
|
|
|
|
|
|
|
private Processor createMailinSetupProcessor(String domName, Pac pac) {
|
|
|
|
return new CompoundProcessor(
|
|
|
|
new ShellProcessor("postmap -r -i /etc/postfix-mailin/relaydomains",
|
|
|
|
domName + " anything\n" +
|
|
|
|
"." + domName + " anything\n"),
|
|
|
|
new ShellProcessor("postmap -r -i /etc/postfix-mailin/transport",
|
|
|
|
domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n" +
|
|
|
|
"." + domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
private Processor createMailinDeleteProcessor(String domName) {
|
2011-08-29 16:09:20 +02:00
|
|
|
Processor mailQueueProcessor = new ShellProcessor(
|
|
|
|
"postmap -d '" + domName + "' /etc/postfix-mailin/relaydomains && " +
|
2011-07-20 14:11:43 +02:00
|
|
|
"postmap -d '" + domName + "' /etc/postfix-mailin/transport && " +
|
|
|
|
"postmap -d '." + domName + "' /etc/postfix-mailin/relaydomains && " +
|
|
|
|
"postmap -d '." + domName + "' /etc/postfix-mailin/transport");
|
|
|
|
return mailQueueProcessor;
|
|
|
|
}
|
|
|
|
|
|
|
|
private CompoundProcessor createDomainDirectoriesProcessor(Domain dom, Map<String, String> templateVars) throws ProcessorException {
|
|
|
|
UnixUser domUser = dom.getUser();
|
|
|
|
String domName = dom.getName();
|
2011-08-03 19:05:20 +02:00
|
|
|
Pac pac = domUser.getPac();
|
2011-10-21 16:10:41 +02:00
|
|
|
boolean dynamicWeb = pac.isDynamicWeb() || dom.isPacDomain();
|
2011-08-03 19:05:20 +02:00
|
|
|
String pacName = pac.getName();
|
2011-09-01 12:02:06 +02:00
|
|
|
String homeDir = domUser.getHomedir();
|
|
|
|
String domsDir = homeDir + "/doms";
|
2011-07-20 14:11:43 +02:00
|
|
|
String userName = domUser.getName();
|
2010-10-05 21:42:07 +02:00
|
|
|
String domainDir = domsDir + "/" + dom.getName();
|
2011-08-03 19:05:20 +02:00
|
|
|
String[] subDirs = dynamicWeb ? DW_STRUCTURE : SW_STRUCTURE;
|
2011-09-01 12:02:06 +02:00
|
|
|
String httpdRights = "";
|
|
|
|
if (pacName != userName) {
|
|
|
|
httpdRights =
|
|
|
|
"chgrp httpd " + homeDir + " && " +
|
|
|
|
"chmod g+rx " + homeDir + " && ";
|
|
|
|
}
|
2010-10-05 21:42:07 +02:00
|
|
|
Processor mkDomainDirProzessor =
|
2011-09-01 12:02:06 +02:00
|
|
|
new ShellProcessor( httpdRights +
|
|
|
|
"chgrp httpd " + homeDir + " && " +
|
|
|
|
"chmod g+rx " + homeDir + " && " +
|
2010-10-05 21:42:07 +02:00
|
|
|
"mkdir --mode=1550 --parents " + domsDir + " && " +
|
|
|
|
"chown httpd:" + pacName + " " + domsDir + " && " +
|
|
|
|
"mkdir --mode=750 " + domainDir + " && " +
|
|
|
|
"chown " + userName + ":httpd " + domainDir
|
|
|
|
);
|
|
|
|
CompoundProcessor domDirsProcessor = new CompoundProcessor(mkDomainDirProzessor);
|
|
|
|
for (String subDir : subDirs) {
|
|
|
|
domDirsProcessor.appendProcessor(new ShellProcessor(
|
|
|
|
"mkdir --mode=755 " + domainDir + "/" + subDir + " && " +
|
|
|
|
"chown " + userName + ":" + pacName + " " + domainDir + "/" + subDir
|
|
|
|
));
|
|
|
|
}
|
2011-05-19 18:03:59 +02:00
|
|
|
templateVars.put("PROTOCOL", "http");
|
2010-10-05 21:42:07 +02:00
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs/.htaccess", userName, pacName, "644")
|
|
|
|
);
|
2011-05-19 18:03:59 +02:00
|
|
|
templateVars.put("PROTOCOL", "https");
|
2010-10-05 21:42:07 +02:00
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs-ssl/.htaccess", userName, pacName, "644")
|
|
|
|
);
|
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs/www/index.html", userName, pacName, "644")
|
|
|
|
);
|
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644")
|
|
|
|
);
|
2011-08-03 19:05:20 +02:00
|
|
|
if (dynamicWeb) {
|
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi/test.cgi", userName, pacName, "755")
|
|
|
|
);
|
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi-ssl/test.cgi", userName, pacName, "755")
|
|
|
|
);
|
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755")
|
|
|
|
);
|
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi-ssl/phpstub", userName, pacName, "755")
|
2010-10-05 21:42:07 +02:00
|
|
|
);
|
2011-08-03 19:05:20 +02:00
|
|
|
}
|
2010-10-05 21:42:07 +02:00
|
|
|
domDirsProcessor.appendProcessor(
|
|
|
|
new ShellProcessor("ln -s " + domainDir + " /home/doms/ && " +
|
2011-07-15 17:30:26 +02:00
|
|
|
"chown --no-dereference " + userName + ":httpd /home/doms/" + domName
|
2010-10-05 21:42:07 +02:00
|
|
|
+ " && " + "chown " + userName + ":httpd /home/doms/" + domName + "/")
|
|
|
|
);
|
2011-07-20 14:11:43 +02:00
|
|
|
return domDirsProcessor;
|
2010-10-05 21:42:07 +02:00
|
|
|
}
|
|
|
|
|
2011-07-20 14:11:43 +02:00
|
|
|
private Processor createApacheVHostSetupProcessor(Domain dom, Map<String, String> templateVars)
|
|
|
|
throws ProcessorException {
|
|
|
|
String domName = dom.getName();
|
|
|
|
Processor domSetupProcessor = new CompoundProcessor(
|
|
|
|
createDomainDirectoriesProcessor(dom, templateVars),
|
|
|
|
new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-generated/" + domName, "root", "root", "644"),
|
|
|
|
new ShellProcessor("ln -sf /etc/apache2/sites-generated/" + domName + " /etc/apache2/sites-enabled/010-" + domName + " && invoke-rc.d apache2 reload >/dev/null 2>&1")
|
|
|
|
);
|
|
|
|
return domSetupProcessor;
|
2010-10-05 21:42:07 +02:00
|
|
|
}
|
|
|
|
|
2011-07-20 14:11:43 +02:00
|
|
|
private Processor createApacheVHostDeleteProcessor(Domain dom) {
|
2010-10-05 21:42:07 +02:00
|
|
|
String domName = dom.getName();
|
|
|
|
Processor vhostDelProcessor =
|
|
|
|
new ShellProcessor("rm /home/doms/" + domName +
|
|
|
|
" && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
|
|
|
|
" && rm /etc/apache2/sites-generated/" + domName +
|
|
|
|
" && rm /etc/apache2/sites-*/`ls -1 /etc/apache2/sites-enabled/ | egrep \"^[01]+-" + domName + "$\"`" +
|
|
|
|
" && invoke-rc.d apache2 reload >/dev/null 2>&1");
|
2011-07-20 14:11:43 +02:00
|
|
|
return vhostDelProcessor;
|
|
|
|
}
|
|
|
|
|
2011-10-28 15:28:19 +02:00
|
|
|
private Processor createMovePacDomainContent(EntityManager em, Domain dom) {
|
|
|
|
Pac pac = dom.getUser().getPac();
|
2011-10-28 16:51:11 +02:00
|
|
|
String pacDir = "/home/pacs/" + pac.getName();
|
2011-10-28 15:28:19 +02:00
|
|
|
String domDir = pacDir + "/doms/" + pac.getName() + ".hostsharing.net";
|
|
|
|
String[] sourceDirs = new String[] { "web", "web-ssl", "cgi", "cgi-ssl", "fastcgi", "fastcgi-ssl" } ;
|
|
|
|
String[] targetDirs = new String[] { "htdocs", "htdocs-ssl", "cgi", "cgi-ssl", "fastcgi", "fastcgi-ssl" } ;
|
|
|
|
CompoundProcessor processor = new CompoundProcessor(
|
2011-12-16 16:09:23 +01:00
|
|
|
new ShellProcessor("rm -rf " + domDir + "/subs " + domDir + "/htdocs/.htaccess "
|
|
|
|
+ domDir + "/subs-ssl " + domDir + "/htdocs-ssl/.htaccess "));
|
2011-10-28 15:28:19 +02:00
|
|
|
for (int idx = 0; idx < sourceDirs.length; idx++) {
|
|
|
|
processor.appendProcessor(
|
2011-12-16 16:24:15 +01:00
|
|
|
new ShellProcessor("shopt -s dotglob && ls " + pacDir + "/" + sourceDirs[idx] + " >/dev/null 2>&1" +
|
2011-12-16 16:09:23 +01:00
|
|
|
" && mv " + pacDir + "/" + sourceDirs[idx] + "/* " + domDir + "/" + targetDirs[idx] + "/ " +
|
2011-12-16 16:38:31 +01:00
|
|
|
" && rmdir " + pacDir + "/" + sourceDirs[idx] +
|
|
|
|
" || echo 'directory " + pacDir + "/" + sourceDirs[idx] + " not found'"));
|
2011-10-28 15:28:19 +02:00
|
|
|
}
|
|
|
|
return processor;
|
|
|
|
}
|
|
|
|
|
2011-07-20 14:11:43 +02:00
|
|
|
private String selectVHostTemplate(Domain dom) {
|
|
|
|
String domName = dom.getName();
|
|
|
|
UnixUser user = dom.getUser();
|
|
|
|
Pac pac = user.getPac();
|
|
|
|
if (domName.equals(pac.getName() + ".hostsharing.net")) {
|
|
|
|
return "/de/hsadmin/mods/dom/httpd-vhost-dynamic.jtpl";
|
|
|
|
}
|
2011-10-21 16:10:41 +02:00
|
|
|
if (pac.isDynamicWeb() || dom.isPacDomain()) {
|
2011-07-20 14:11:43 +02:00
|
|
|
return "/de/hsadmin/mods/dom/httpd-vhost-dynamic.jtpl";
|
|
|
|
}
|
|
|
|
return "/de/hsadmin/mods/dom/httpd-vhost-static.jtpl";
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getCurrentIPAddress(Pac pac) {
|
|
|
|
return pac.getCurINetAddr().getInetAddr();
|
|
|
|
}
|
|
|
|
|
|
|
|
private String getOldIPAddress(Pac pac) {
|
|
|
|
INetAddress oldINetAddr = pac.getOldINetAddr();
|
|
|
|
if (oldINetAddr != null) {
|
|
|
|
return oldINetAddr.getInetAddr();
|
|
|
|
} else {
|
|
|
|
return getCurrentIPAddress(pac);
|
|
|
|
}
|
2010-10-05 21:42:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|