Fix bei der Loeschung eines Links in /etc/apache2/sites-enabled

This commit is contained in:
Peter Hormanns 2012-06-15 14:37:21 +00:00
parent 389c9f23c4
commit 8db019e5eb

View File

@ -265,7 +265,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ")" + " && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ")" +
" || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName), " || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName),
new ShellProcessor( new ShellProcessor(
"ln -sf /etc/apache2/sites-available/" + domName + " /etc/apache2/sites-enabled/" + linkPrefix + "-"+ domName + "ln -sf /etc/apache2/sites-available/" + domName + " /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
" && invoke-rc.d apache2 reload >/dev/null 2>&1") " && invoke-rc.d apache2 reload >/dev/null 2>&1")
); );
return domSetupProcessor; return domSetupProcessor;
@ -273,11 +273,13 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
private Processor createApacheVHostDeleteProcessor(Domain dom) { private Processor createApacheVHostDeleteProcessor(Domain dom) {
String domName = dom.getName(); String domName = dom.getName();
int level = domName.split("\\.").length;
String linkPrefix = Integer.toString(100 - level);
Processor vhostDelProcessor = Processor vhostDelProcessor =
new ShellProcessor("rm /home/doms/" + domName + new ShellProcessor("rm /home/doms/" + domName +
" && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName + " && rm /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
" && rm /etc/apache2/sites-available/" + domName + " && rm /etc/apache2/sites-available/" + domName +
" && rm /etc/apache2/sites-*/`ls -1 /etc/apache2/sites-enabled/ | egrep \"^[01]+-" + domName + "$\"`" + " && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
" && invoke-rc.d apache2 reload >/dev/null 2>&1"); " && invoke-rc.d apache2 reload >/dev/null 2>&1");
return vhostDelProcessor; return vhostDelProcessor;
} }