From cf646e99be232c783dcbae86e329470674772749 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 23 Jan 2014 03:50:27 -0500
Subject: [PATCH] Merge remote-tracking branch 'origin/stable-3.0.5'
---
server/plugins-available/apache2_plugin.inc.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index db47d58..c8a5e1e 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1019,6 +1019,7 @@
}
$tpl->setVar($vhost_data);
+ $tpl->setVar('apache_version', $app->system->getapacheversion());
// Rewrite rules
$rewrite_rules = array();
@@ -1225,6 +1226,7 @@
$fcgi_tpl = new tpl();
$fcgi_tpl->newTemplate('php-fcgi-starter.master');
+ $fcgi_tpl->setVar('apache_version', $app->system->getapacheversion());
// Support for multiple PHP versions (FastCGI)
if(trim($data['new']['fastcgi_php_version']) != ''){
@@ -1364,6 +1366,7 @@
$cgi_tpl = new tpl();
$cgi_tpl->newTemplate('php-cgi-starter.master');
+ $cgi_tpl->setVar('apache_version', $app->system->getapacheversion());
// This works because PHP "rewrites" a symlink to the physical path
$php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir'];
@@ -1984,6 +1987,34 @@
$app->services->restartServiceDelayed('httpd', 'reload');
}
+ //* Delete the web-backups
+ if($data['old']['type'] == 'vhost') {
+ $server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
+ $backup_dir = $server_config['backup_dir'];
+ //* mount backup directory, if necessary
+ $mount_backup = true;
+ $server_config['backup_dir_mount_cmd'] = trim($server_config['backup_dir_mount_cmd']);
+ if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') {
+ if($server_config['backup_dir_is_mount'] == 'y' && $server_config['backup_dir_mount_cmd'] != ''){
+ if(!$app->system->is_mounted($backup_dir)){
+ exec(escapeshellcmd($server_config['backup_dir_mount_cmd']));
+ sleep(1);
+ if(!$app->system->is_mounted($backup_dir)) $mount_backup = false;
+ }
+ }
+ if($mount_backup){
+ $web_backup_dir = $backup_dir.'/web'.$data_old['domain_id'];
+ //** do not use rm -rf $web_backup_dir because database(s) may exits
+ exec(escapeshellcmd('rm -f '.$web_backup_dir.'/web'.$data_old['domain_id'].'_').'*');
+ //* cleanup database
+ $sql = "DELETE FROM web_backup WHERE server_id = ".$conf['server_id']." AND parent_domain_id = ".$data_old['domain_id']." AND filename LIKE 'web".$data_old['domain_id']."_%'";
+ $app->db->query($sql);
+ if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql);
+
+ $app->log('Deleted the web backup files', LOGLEVEL_DEBUG);
+ }
+ }
+ }
}
if($data['old']['type'] != 'vhost') $app->system->web_folder_protection($data['old']['document_root'], true);
}
@@ -2000,6 +2031,7 @@
$tpl = new tpl();
$tpl->newTemplate('apache_ispconfig.conf.master');
+ $tpl->setVar('apache_version', $app->system->getapacheversion());
$records = $app->db->queryAllRecords('SELECT * FROM server_ip WHERE server_id = '.$conf['server_id']." AND virtualhost = 'y'");
$records_out= array();
@@ -2626,13 +2658,22 @@
}
$content = '';
- $content .= "Include \"".$awstats_conf_dir."/awstats.conf\"\n";
+ if (is_file($awstats_conf_dir."/awstats.conf")) {
+ $include_file = $awstats_conf_dir."/awstats.conf";
+ } elseif (is_file($awstats_conf_dir."/awstats.model.conf")) {
+ $include_file = $awstats_conf_dir."/awstats.model.conf";
+ }
+ $content .= "Include \"".$include_file."\"\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";
- $app->system->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);
+ if (isset($include_file)) {
+ $app->system->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);
+ } else {
+ $app->log("No awstats base config found. Either awstats.conf or awstats.model.conf must exist in ".$awstats_conf_dir.".", LOGLEVEL_WARN);
+ }
}
if(is_file($data['new']['document_root']."/" . $web_folder . "/stats/index.html")) $app->system->unlink($data['new']['document_root']."/" . $web_folder . "/stats/index.html");
@@ -2700,7 +2741,8 @@
$app->load('tpl');
$tpl = new tpl();
$tpl->newTemplate('php_fpm_pool.conf.master');
-
+ $tpl->setVar('apache_version', $app->system->getapacheversion());
+
if($data['new']['php_fpm_use_socket'] == 'y'){
$use_tcp = 0;
$use_socket = 1;
@@ -2719,6 +2761,7 @@
$tpl->setVar('fpm_port', $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1);
$tpl->setVar('fpm_user', $data['new']['system_user']);
$tpl->setVar('fpm_group', $data['new']['system_group']);
+ $tpl->setVar('fpm_domain', $data['new']['domain']);
$tpl->setVar('pm', $data['new']['pm']);
$tpl->setVar('pm_max_children', $data['new']['pm_max_children']);
$tpl->setVar('pm_start_servers', $data['new']['pm_start_servers']);
--
Gitblit v1.9.1