Fixed migration code: pac domain to subdomain
This commit is contained in:
parent
e33737aaf6
commit
48c8d27773
@ -370,17 +370,32 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
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(
|
||||
new ShellProcessor("rm -rf " + domDir + "/subs " + domDir + "/htdocs/.htaccess "
|
||||
+ domDir + "/subs-ssl " + domDir + "/htdocs-ssl/.htaccess "));
|
||||
CompoundProcessor processor = new CompoundProcessor();
|
||||
for (int idx = 0; idx < targetDirs.length; idx++) {
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("rm -rf " + domDir + targetDirs[idx]));
|
||||
}
|
||||
for (int idx = 0; idx < sourceDirs.length; idx++) {
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("shopt -s dotglob && ls " + pacDir + "/" + sourceDirs[idx] + " >/dev/null 2>&1" +
|
||||
" && mv " + pacDir + "/" + sourceDirs[idx] + "/* " + domDir + "/" + targetDirs[idx] + "/ " +
|
||||
" && ( rmdir " + pacDir + "/" + sourceDirs[idx] + " || rm " + pacDir + "/" + sourceDirs[idx] + " ) " +
|
||||
" && mv " + pacDir + "/" + sourceDirs[idx] + domDir + "/" + targetDirs[idx] +
|
||||
" || echo 'directory " + pacDir + "/" + sourceDirs[idx] + " not found'"));
|
||||
}
|
||||
return processor;
|
||||
}
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("test -L " + domDir + "/htdocs" +
|
||||
" && `stat -c '%N' " + domDir + "/htdocs |sed -e's/^.*`//' -e\"s/'$//\"` = web-ssl " +
|
||||
" && cd " + domDir +
|
||||
" && rm " + domDir + "/htdocs" +
|
||||
" && ln -sf htdocs-ssl htdocs" +
|
||||
" && chown -h " + pac + ":" + pac + " " + domDir + "/htdocs"));
|
||||
processor.appendProcessor(
|
||||
new ShellProcessor("test -L " + domDir + "/htdocs-ssl" +
|
||||
" && `stat -c '%N' " + domDir + "/htdocs-ssl |sed -e's/^.*`//' -e\"s/'$//\"` = web " +
|
||||
" && cd " + domDir +
|
||||
" && rm " + domDir + "/htdocs-ssl" +
|
||||
" && ln -sf htdocs htdocs-ssl" +
|
||||
" && chown -h " + pac + ":" + pac + " " + domDir + "/htdocs-ssl"));
|
||||
return processor;
|
||||
}
|
||||
|
||||
private String selectVHostTemplate(Domain dom) {
|
||||
|
Loading…
Reference in New Issue
Block a user