#1  
Old 14th July 2013, 21:03
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
Default Create a new default folder

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 !
Reply With Quote
Sponsored Links
  #2  
Old 16th July 2013, 08:26
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
Default

Maybe in /usr/local/ispconfig/server/conf/ no ?
Reply With Quote
  #3  
Old 18th July 2013, 00:39
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
Default

I checked /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php and i founded :
Quote:
if(!is_dir($data['new']['document_root'].'/private')) {
$app->system->mkdirpath($data['new']['document_root'].'/private');
$app->system->chmod($data['new']['document_root'].'/private',0710);
$app->system->chown($data['new']['document_root'].'/private',$username);
$app->system->chgrp($data['new']['document_root'].'/private',$groupname);
}
So if i simply add this :
Quote:
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);
}
It's will work ?

Last edited by Typhon; 18th July 2013 at 06:46.
Reply With Quote
  #4  
Old 18th July 2013, 09:47
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,794
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 18th July 2013, 09:56
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
Default

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 ?
Reply With Quote
  #6  
Old 19th July 2013, 06:03
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
Default

Hi !
I think you i founded the solution, if i do so, it's will work ? :
PHP Code:
$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 Code:
$client $app->db->queryOneRecord("SELECT `template_master` FROM `client` WHERE `username` = '" intval($username) . "'"); 
OR
PHP Code:
$client $app->db->queryOneRecord("SELECT `template_master` FROM `client` WHERE `groupname` = '" intval($groupname) . "'"); 
Reply With Quote
  #7  
Old 19th July 2013, 10:28
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,794
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
The Following User Says Thank You to till For This Useful Post:
Typhon (19th July 2013)
  #8  
Old 19th July 2013, 10:38
Typhon Typhon is offline
Member
 
Join Date: Dec 2011
Posts: 78
Thanks: 27
Thanked 4 Times in 3 Posts
 
Default

Quote:
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.
yeah sorry it was really stupid.
Ok thank you !
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Email Working ISPConfig3 Squirrelmail and Courier etc Ian Wilson Installation/Configuration 17 19th June 2013 23:58
Cannot send or receive mail farbrorc Installation/Configuration 6 24th January 2010 12:56
421 Unexpected failure Lizard King Installation/Configuration 20 7th July 2009 21:43
localhost postfix/master: fatal: bind 127.0.0.1 port 125: Permission denied g18c Installation/Configuration 4 24th March 2009 18:39
Verify email setup meekish Installation/Configuration 28 27th October 2006 16:36


All times are GMT +2. The time now is 17:01.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.