daniel
2008-06-05 a91fdb2f9c8705d68bff3c5ec3037d7ba5490512
Log symlinks changed 
6 files modified
49 ■■■■ changed files
install/sql/ispconfig3.sql 5 ●●●●● patch | view | raw | blame | history
interface/web/sites/form/shell_user.tform.php 6 ●●●●● patch | view | raw | blame | history
interface/web/sites/lib/lang/en_shell_user.lng 1 ●●●● patch | view | raw | blame | history
interface/web/sites/shell_user_edit.php 3 ●●●● patch | view | raw | blame | history
interface/web/sites/templates/shell_user_edit.htm 8 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 26 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql
@@ -524,7 +524,6 @@
-- --------------------------------------------------------
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 @@
  `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 für Tabelle `shell_user`
interface/web/sites/form/shell_user.tform.php
@@ -105,6 +105,12 @@
            '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',
interface/web/sites/lib/lang/en_shell_user.lng
@@ -9,6 +9,7 @@
$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.';
interface/web/sites/shell_user_edit.php
@@ -80,8 +80,9 @@
        $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);
        
    }
interface/web/sites/templates/shell_user_edit.htm
@@ -24,6 +24,14 @@
    <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>
  </tr>
server/plugins-available/apache2_plugin.inc.php
@@ -218,18 +218,17 @@
        
        // 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 @@
        
        $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