Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
$vhost_file = escapeshellcmd($web_config['nginx_vhost_conf_dir'].'/ispconfig.conf');
file_put_contents($vhost_file,$tpl->grab());
$app->log('Writing the conf file: '.$vhost_file,LOGLEVEL_DEBUG);
unset($tpl);
}
//* Update the awstats configuration file
private function awstats_update ($data,$web_config) {
global $app;
$awstats_conf_dir = $web_config['awstats_conf_dir'];
if(!@is_file($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf') || ($data['old']['domain'] != '' && $data['new']['domain'] != $data['old']['domain'])) {
if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
}
$content = '';
$content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
$content .= "LogFile=\"/var/log/ispconfig/httpd/".$data['new']['domain']."/access.log\"\n";
$content .= "SiteDomain=\"".$data['new']['domain']."\"\n";
$content .= "HostAliases=\"www.".$data['new']['domain']." localhost 127.0.0.1\"\n";
file_put_contents($awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',$content);
$app->log('Created AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['new']['domain'].'.conf',LOGLEVEL_DEBUG);
}
}
//* Delete the awstats configuration file
private function awstats_delete ($data,$web_config) {
global $app;
$awstats_conf_dir = $web_config['awstats_conf_dir'];

latham
committed
if ( @is_file($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf') ) {
unlink($awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf');
$app->log('Removed AWStats config file: '.$awstats_conf_dir.'/awstats.'.$data['old']['domain'].'.conf',LOGLEVEL_DEBUG);
}

latham
committed
}

latham
committed
global $app, $conf;
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
$app->uses("getconf");
$web_config = $app->getconf->get_server_config($conf["server_id"], 'web');
$client_id = intval($data['old']['client_id']);
if($client_id > 0) {
$client_dir = $web_config['website_basedir'].'/clients/client'.$client_id;
if(is_dir($client_dir) && !stristr($client_dir,'..')) {
@rmdir($client_dir);
$app->log('Removed client directory: '.$client_dir,LOGLEVEL_DEBUG);
}
$this->_exec('groupdel client'.$client_id);
$app->log('Removed group client'.$client_id,LOGLEVEL_DEBUG);
}
}
//* Wrapper for exec function for easier debugging
private function _exec($command) {
global $app;
$app->log('exec: '.$command,LOGLEVEL_DEBUG);
exec($command);

latham
committed
}
private function _checkTcp ($host,$port) {
$fp = @fsockopen ($host, $port, $errno, $errstr, 2);

latham
committed
if ($fp) {
fclose($fp);
return true;
} else {
return false;
}

latham
committed
}

latham
committed
} // end class