Commit a91fdb2f authored by daniel's avatar daniel
Browse files

Log symlinks changed

parent a9b823db
......@@ -524,7 +524,6 @@ CREATE TABLE `server_ip` (
-- --------------------------------------------------------
CREATE TABLE `shell_user` (
`shell_user_id` bigint(20) NOT NULL auto_increment,
`sys_userid` int(11) NOT NULL default '0',
......@@ -542,8 +541,10 @@ CREATE TABLE `shell_user` (
`pgroup` varchar(255) default NULL,
`shell` varchar(255) NOT NULL default '/bin/bash',
`dir` varchar(255) default NULL,
`chroot` varchar(255) NOT NULL,
PRIMARY KEY (`shell_user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
--
-- Daten fr Tabelle `shell_user`
......
......@@ -105,6 +105,12 @@ $form["tabs"]['shell'] = array (
'width' => '30',
'maxlength' => '255'
),
'chroot' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
'value' => array('' => 'None', 'jailkit' => 'Jailkit', 'ssh-chroot' => 'SSH Chroot')
),
'quota_size' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
......
......@@ -9,6 +9,7 @@ $wb["server_id_txt"] = 'Server';
$wb["parent_domain_id_txt"] = 'Site';
$wb["username_txt"] = 'Username';
$wb["password_txt"] = 'Password';
$wb["chroot_txt"] = 'Chroot Shell';
$wb["quota_size_txt"] = 'Quota';
$wb["active_txt"] = 'Active';
$wb["username_error_empty"] = 'Username is empty.';
......
......@@ -80,8 +80,9 @@ class page_action extends tform_actions {
$dir = $web["document_root"];
$puser = $web["system_user"];
$pgroup = $web["system_group"];
$chroot = $web["chroot"];
$sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$puser', pgroup = '$pgroup' WHERE shell_user_id = ".$this->id;
$sql = "UPDATE shell_user SET server_id = $server_id, dir = '$dir', puser = '$puser', pgroup = '$pgroup' chroot='$chroot' WHERE shell_user_id = ".$this->id;
$app->db->query($sql);
}
......
......@@ -23,6 +23,14 @@
<td class="frmText11">{tmpl_var name='password_txt'}:</td>
<td class="frmText11"><input name="password" type="password" class="text" value="{tmpl_var name='password'}" size="30" maxlength="255"></td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='chroot_txt'}:</td>
<td class="frmText11">
<select name="chroot" class="text">
{tmpl_var name='chroot'}
</select>
</td>
</tr>
<tr>
<td class="frmText11">{tmpl_var name='quota_size_txt'}:</td>
<td class="frmText11"><input name="quota_size" type="text" class="text" value="{tmpl_var name='quota_size'}" size="7" maxlength="7"></td>
......
......@@ -218,18 +218,17 @@ class apache2_plugin {
// Remove the symlink for the site, if site is renamed
if($this->action == 'update' && $data["old"]["domain"] != '' && $data["new"]["domain"] != $data["old"]["domain"]) {
if(is_dir('/var/log/ispconfig/httpd/'.$data["old"]["domain"])) exec('rm -rf /var/log/ispconfig/httpd/'.$data["old"]["domain"]);
if(is_link($data["old"]["document_root"]."/log")) unlink($data["old"]["document_root"]."/log");
if(is_dir($data["old"]["document_root"]."/log")) exec('rm -rf '.$data["old"]["document_root"]."/log");
if(is_link('/var/log/ispconfig/httpd/'.$data["old"]["domain"])) unlink('/var/log/ispconfig/httpd/'.$data["old"]["domain"]);
}
// Create the symlink for the logfiles
if(!is_dir('/var/log/ispconfig/httpd/'.$data["new"]["domain"])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data["new"]["domain"]);
if(!is_link($data["new"]["document_root"]."/log")) {
exec("ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log");
$app->log("Creating Symlink: ln -s /var/log/ispconfig/httpd/".$data["new"]["domain"]." ".$data["new"]["document_root"]."/log",LOGLEVEL_DEBUG);
if(!is_dir($data["new"]["document_root"]."/log")) exec('mkdir -p '.$data["new"]["document_root"]."/log");
if(!is_link('/var/log/ispconfig/httpd/'.$data["new"]["domain"])) {
exec("ln -s ".$data["new"]["document_root"]."/log /var/log/ispconfig/httpd/".$data["new"]["domain"]);
$app->log("Creating Symlink: ln -s ".$data["new"]["document_root"]."/log /var/log/ispconfig/httpd/".$data["new"]["domain"],LOGLEVEL_DEBUG);
}
// Get the client ID
$client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["new"]["sys_groupid"]));
$client_id = intval($client["client_id"]);
......@@ -462,6 +461,17 @@ class apache2_plugin {
$docroot = escapeshellcmd($data["old"]["document_root"]);
if($docroot != '' && !stristr($docroot,'..')) exec("rm -rf $docroot");
//remove the php fastgi starter script if available
if ($data["old"]["php"] == "fast-cgi")
{
$fastcgi_starter_path = str_replace("[system_user]",$data["old"]["system_user"],$web_config["fastcgi_starter_path"]);
if (is_dir($fastcgi_starter_path))
{
exec("rm -rf $fastcgi_starter_path");
}
}
$app->log("Removing website: $docroot",LOGLEVEL_DEBUG);
// Delete the symlinks for the sites
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment