Create a new default folder

Discussion in 'Installation/Configuration' started by Typhon, Jul 14, 2013.

  1. Typhon

    Typhon New Member

    Hi,
    I want to create a new folder for new clients with a specific Client-Templates.
    For example when I create a new client with the template called XXX in his ftp he will have :
    -defaults folders
    -new folder 1
    -new record 2
    And in the folder 1 he will have one static file (which does not change) welcome.txt
    Thank you !
     
  2. Typhon

    Typhon New Member

    Maybe in /usr/local/ispconfig/server/conf/ no ?
     
  3. Typhon

    Typhon New Member

    I checked /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php and i founded :
    So if i simply add this :
    It's will work ?
     
    Last edited: Jul 18, 2013
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, that should work. A more update-safe way would be to write a small plugin that attaches itself to the web domain insert and update events too and add the code to create the folder in there.
     
  5. Typhon

    Typhon New Member

    Ah thank you Till, there a a doc or something ?
    There are a solution to create this folder only for costumers with client-template id 1 for exemple ?
     
  6. Typhon

    Typhon New Member

    Hi !
    I think you i founded the solution, if i do so, it's will work ? :
    PHP:
    $client $app->db->queryOneRecord("SELECT `template_master` FROM `client` WHERE `client_id` = '" intval($client_id) . "'");
    if(
    $client['template_master'] == 5)
    {
    if(!
    is_dir($data['new']['document_root'].'/newFolder')) {
    $app->system->mkdirpath($data['new']['document_root'].'/newFolder');
    $app->system->chmod($data['new']['document_root'].'/newFolder',0710);
    $app->system->chown($data['new']['document_root'].'/newFolder',$username);
    $app->system->chgrp($data['new']['document_root'].'/newFolder',$groupname);
    }
    if (
    file_exists($data['new']['document_root'].'/newFolder/readme.txt')) {
    exec('cp '$conf['rootpath'] . '/conf-custom/newFolder/readme.txt '.$data['new']['document_root'].'/newFolder/readme.txt');
    $app->system->chmod($data['new']['document_root'].'/newFolder/readme.txt',0710);
    $app->system->chown($data['new']['document_root'].'/newFolder/readme.txt',$username);
    $app->system->chgrp($data['new']['document_root'].'/newFolder/readme.txt',$groupname);
    }
    }
    And it's better to use
    PHP:
    $client $app->db->queryOneRecord("SELECT `template_master` FROM `client` WHERE `username` = '" intval($username) . "'");
    OR
    PHP:
    $client $app->db->queryOneRecord("SELECT `template_master` FROM `client` WHERE `groupname` = '" intval($groupname) . "'");
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Neither the username of the site nor the groupname of the site are stored in the client table, so you can not use them to query the template_master value. Better use the client_id.
     
  8. Typhon

    Typhon New Member

    :D yeah sorry it was really stupid.
    Ok thank you !
     

Share This Page