| | |
| | | unset($htp_file); |
| | | } |
| | | } |
| | | |
| | | //* Create awstats configuration |
| | | if($data["new"]["stats_type"] == 'awstats' && $data["new"]["type"] == "vhost") { |
| | | $this->awstats_update($data,$web_config); |
| | | } |
| | | |
| | | |
| | | if($apache_chrooted) { |
| | |
| | | $command .= ' '.$data["old"]["system_user"]; |
| | | exec($command); |
| | | if($apache_chrooted) $this->_exec("chroot ".escapeshellcmd($web_config['website_basedir'])." ".$command); |
| | | |
| | | //* Remove the awstats configuration file |
| | | if($data["old"]["stats_type"] == 'awstats') { |
| | | $this->awstats_delete($data,$web_config); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | file_put_contents($fileName, $output); |
| | | |
| | | } |
| | | |
| | | //* 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']; |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | //* Wrapper for exec function for easier debugging |
| | | private function _exec($command) { |