Creating extra folders for new websites.

Discussion in 'Installation/Configuration' started by Gleno0h, Jul 20, 2009.

  1. Gleno0h

    Gleno0h New Member

    Hey!

    Well after installing ispconfig3 i was kinda bussy with making a script for new users to auto install joomla, phpbb3 etc.

    Now my question is, how can i add a extra folder to the new sites that i create?

    It now makes the folders:
    cgi-bin
    ssl
    tmp
    web
    -error
    -stats

    but what i want is
    cgi-bin
    ssl
    tmp
    web
    -error
    -stats
    -extra

    How can i make it like that for every new website?

    Thanks!
     
  2. dzudzu

    dzudzu New Member

    This is just from my own research so wait for confirmation but till then u can toy around with this:

    in /usr/local/ispconfig/server/plugins-enabled

    file: apache2_plugin.inc.php

    there is this code

    // make temp direcory writable for the apache user and the website user
    exec("chmod 777 ".escapeshellcmd($data["new"]["document_root"]."/tmp"));

    i belive u can add another line below with appropriate chmod like 755 so it gets created

    as example u asked i guess it would be something like:
    exec("chmod 755 ".escapeshellcmd($data["new"]["document_root"]."/extra"));

    thou note that index file is in web folder so i guess u maybe want to make /web/extra

    just few of my thoughts
     
  3. Gleno0h

    Gleno0h New Member

    Well that didnt do it. Its too bad i could find a tut about it, but thanks to you i got in a direction and managed to do it.

    Small tutorial:

    nano /usr/local/ispconfig/server/plugins-enabled/apache2_plug*
    find the text containing:
    Code:
    // Check if the directories are there and create them if nescessary.
    if(!is_dir($data["new"]["document_root"]."/web")) exec("mkdir -p ".$data["new"]["document_root"]."/web");
    if(!is_dir($data["new"]["document_root"]."/web/error") and $data["new"]["errordocs"]) exec("mkdir -p ".$data["new"]["document_root"]."/web/error");
    //if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log");
    if(!is_dir($data["new"]["document_root"]."/ssl")) exec("mkdir -p ".$data["new"]["document_root"]."/ssl");
    if(!is_dir($data["new"]["document_root"]."/cgi-bin")) exec("mkdir -p ".$data["new"]["document_root"]."/cgi-bin");
    if(!is_dir($data["new"]["document_root"]."/tmp")) exec("mkdir -p ".$data["new"]["document_root"]."/tmp");
    
    then add this at the end

    Code:
    if(!is_dir($data["new"]["document_root"]."/web/extra")) exec("mkdir -p ".$data["new"]["document_root"]."/web/extra");
    
    so it becomes;

    Code:
    // Check if the directories are there and create them if nescessary.
    if(!is_dir($data["new"]["document_root"]."/web")) exec("mkdir -p ".$data["new"]["document_root"]."/web");
    if(!is_dir($data["new"]["document_root"]."/web/error") and $data["new"]["errordocs"]) exec("mkdir -p ".$data["new"]["document_root"]."/web/error");
    //if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log");
    if(!is_dir($data["new"]["document_root"]."/ssl")) exec("mkdir -p ".$data["new"]["document_root"]."/ssl");
    if(!is_dir($data["new"]["document_root"]."/cgi-bin")) exec("mkdir -p ".$data["new"]["document_root"]."/cgi-bin");
    if(!is_dir($data["new"]["document_root"]."/tmp")) exec("mkdir -p ".$data["new"]["document_root"]."/tmp");
    [COLOR="SeaGreen"]if(!is_dir($data["new"]["document_root"]."/web/extra")) exec("mkdir -p ".$data["new"]["document_root"]."/web/extra");
    [/COLOR]
    
    That makes an extra dir, and for the joomla installer i did this;

    Look for

    Code:
    // copy the standard index page
    if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))){
    exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"][$
    }
    else {
    if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")){
    exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");     $
    }
    else {
    exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]$
    exec("cp /usr/local/ispconfig/server/conf/index/favicon.ico ".escapeshellcmd($data["new"]["document_root"])."/web/");
    exec("cp /usr/local/ispconfig/server/conf/index/robots.txt ".escapeshellcmd($data["new"]["document_root"])."/web/");
    exec("cp /usr/local/ispconfig/server/conf/index/.htaccess ".escapeshellcmd($data["new"]["document_root"])."/web/");
    }
    }
    exec("chmod -R a+r ".escapeshellcmd($data["new"]["document_root"])."/web/");
    
    then add this

    Code:
    exec("cp /usr/local/ispconfig/server/conf/installers/installapps.php ".escapeshellcmd($data["new"]["document_root"])."/web/extra/");
    
    so it becomes;

    Code:
    // copy the standard index page
    if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))){
    exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"][$
    }
    else {
    if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")){
    exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");     $
    }
    else {
    exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]$
    exec("cp /usr/local/ispconfig/server/conf/index/favicon.ico ".escapeshellcmd($data["new"]["document_root"])."/web/");
    exec("cp /usr/local/ispconfig/server/conf/index/robots.txt ".escapeshellcmd($data["new"]["document_root"])."/web/");
    exec("cp /usr/local/ispconfig/server/conf/index/.htaccess ".escapeshellcmd($data["new"]["document_root"])."/web/");
    [COLOR="SeaGreen"]exec("cp /usr/local/ispconfig/server/conf/installers/installapps.php ".escapeshellcmd($data["new"]["document_root"])."/web/extra/");[/COLOR]
    }
    }
    exec("chmod -R a+r ".escapeshellcmd($data["new"]["document_root"])."/web/");
    
    Dont forget, /usr/local/ispconfig/server/conf/INSTALLER/ is a custom dir, you have to make that, but it also could by phpmyadmin for that matther.

    Thnx!
     
    Last edited: Jul 20, 2009
  4. dzudzu

    dzudzu New Member

    ah yes, my command just chmods the dir, didn't pay attention silly me, but great you worked it out :)
     
  5. Gleno0h

    Gleno0h New Member

    Well thats also one thing i needed. "Extra" has to be 777 otherwise it cant make a temp folder when it unzip's .zip packages.
    Then its moved to a folder that the user wants to use and the script chmod's the default folders that needs to have a certain chmod for instalation. Works like a charm!
     

Share This Page