HSAdmin Backend Domains, E-Mail, Datenbanken
Michael Hierweck
2012-10-30 abd74a422fb5e42032139fb71698eaba1dcf7701
Removed: Content migration (packet subdomain)
1 files modified
40 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 40 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -72,9 +72,6 @@
        templateVars.put("DOMAIN", domName);
        templateVars.put("USER_NAME", domUser.getComment());
        mainProcessor.appendProcessor(hiveName, createApacheVHostSetupProcessor(em, dom, templateVars), "Setup Apache VHost");
        if (dom.isPacDomain()) {
            mainProcessor.appendProcessor(hiveName, createMovePacDomainContent(em, dom), "Move pac domain content");
        }
        return mainProcessor;
    }
@@ -370,43 +367,6 @@
                " && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
                " && invoke-rc.d apache2 reload >/dev/null 2>&1");
        return vhostDelProcessor;
    }
    private Processor createMovePacDomainContent(EntityManager em, Domain dom) {
        Pac pac = dom.getUser().getPac();
        String pacName = pac.getName();
        String pacDir = "/home/pacs/" + pacName;
        String domDir = pacDir + "/doms/" + pacName + ".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();
        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] +
                        " || echo 'directory " + pacDir + "/" + sourceDirs[idx] + " not found'"));
        }
        processor.appendProcessor(
                new ShellProcessor("test -L " + domDir + "/htdocs" +
                        " && test $( stat -c '%N' " + domDir + "/htdocs |sed -e\"s/[\\`']//g\" |cut -d ' ' -f 3 ) = web-ssl " +
                        " && cd " + domDir +
                        " && rm " + domDir + "/htdocs" +
                        " && ln -sf htdocs-ssl htdocs" +
                        " && chown -h " + pacName + ":" + pacName + " " + domDir + "/htdocs" +
                        " || echo 'link htdocs not found'"));
        processor.appendProcessor(
                new ShellProcessor("test -L " + domDir + "/htdocs-ssl" +
                        " && test $( stat -c '%N' " + domDir + "/htdocs-ssl |sed -e\"s/[\\`']//g\" |cut -d ' ' -f 3 ) = web " +
                        " && cd " + domDir +
                        " && rm " + domDir + "/htdocs-ssl" +
                        " && ln -sf htdocs htdocs-ssl" +
                        " && chown -h " + pacName + ":" + pacName + " " + domDir + "/htdocs-ssl" +
                        " || echo 'link htdocs-ssl not found'"));
        return processor;
    }
    private String selectVHostTemplate(Domain dom) {