From dc48ab33efda6f56c30d408182cfec868ef4d91f Mon Sep 17 00:00:00 2001 From: xaver <xaver@ispconfig3> Date: Sat, 24 Mar 2012 09:01:29 -0400 Subject: [PATCH] Bug #2143, wrong filter url --- server/plugins-available/apache2_plugin.inc.php | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 935fc9e..47b889c 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -363,7 +363,13 @@ unset($tmp_docroot[count($tmp_docroot)-1]); $old_dir = implode('/',$tmp_docroot); - exec('rm -rf '.$data['new']['document_root']); + //* Check if there is already some data in the new docroot and rename it as we need a clean path to move the existing site to the new path + if(@is_dir($data['new']['document_root'])) { + rename($data['new']['document_root'],$data['new']['document_root'].'_bak_'.date('Y_m_d')); + $app->log('Renaming existing directory in new docroot location. mv '.$data['new']['document_root'].' '.$data['new']['document_root'].'_bak_'.date('Y_m_d'),LOGLEVEL_DEBUG); + } + + //* Create new base directory, if it does not exist yet if(!is_dir($new_dir)) exec('mkdir -p '.$new_dir); exec('mv '.$data['old']['document_root'].' '.$new_dir); $app->log('Moving site to new document root: mv '.$data['old']['document_root'].' '.$new_dir,LOGLEVEL_DEBUG); @@ -903,15 +909,32 @@ $fcgi_tpl = new tpl(); $fcgi_tpl->newTemplate('php-fcgi-starter.master'); + // Support for multiple PHP versions (FastCGI) + if(trim($data['new']['fastcgi_php_version']) != ''){ + $default_fastcgi_php = false; + list($custom_fastcgi_php_name, $custom_fastcgi_php_executable, $custom_fastcgi_php_ini_dir) = explode(':', trim($data['new']['fastcgi_php_version'])); + if(substr($custom_fastcgi_php_ini_dir,-1) != '/') $custom_fastcgi_php_ini_dir .= '/'; + } else { + $default_fastcgi_php = true; + } + if($has_custom_php_ini) { $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_php_ini_dir)); } else { - $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); + if($default_fastcgi_php){ + $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($fastcgi_config['fastcgi_phpini_path'])); + } else { + $fcgi_tpl->setVar('php_ini_path',escapeshellcmd($custom_fastcgi_php_ini_dir)); + } } $fcgi_tpl->setVar('document_root',escapeshellcmd($data['new']['document_root'])); $fcgi_tpl->setVar('php_fcgi_children',escapeshellcmd($fastcgi_config['fastcgi_children'])); $fcgi_tpl->setVar('php_fcgi_max_requests',escapeshellcmd($fastcgi_config['fastcgi_max_requests'])); - $fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin'])); + if($default_fastcgi_php){ + $fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($fastcgi_config['fastcgi_bin'])); + } else { + $fcgi_tpl->setVar('php_fcgi_bin',escapeshellcmd($custom_fastcgi_php_executable)); + } $fcgi_tpl->setVar('security_level',intval($web_config['security_level'])); $php_open_basedir = ($data['new']['php_open_basedir'] == '')?$data['new']['document_root']:$data['new']['php_open_basedir']; -- Gitblit v1.9.1