From 355efb9a7f74a2035f595bbd0d03375710d08587 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 25 Jan 2012 09:43:56 -0500
Subject: [PATCH] Merged revisions 2886-2909 from stable branch.
---
server/plugins-available/nginx_plugin.inc.php | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 79fa68d..149a4d1 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -41,7 +41,7 @@
function onInstall() {
global $conf;
- if($conf['services']['web'] == true) {
+ if($conf['services']['web'] == true && !@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
return true;
} else {
return false;
@@ -256,7 +256,13 @@
function update($event_name,$data) {
global $app, $conf;
-
+
+ //* Check if the apache plugin is enabled
+ if(@is_link('/usr/local/ispconfig/server/plugins-enabled/apache2_plugin.inc.php')) {
+ $app->log('The nginx plugin can not be used together with the apache2 plugin..',LOGLEVEL_WARN);
+ return 0;
+ }
+
if($this->action != 'insert') $this->action = 'update';
if($data['new']['type'] != 'vhost' && $data['new']['parent_domain_id'] > 0) {
@@ -333,8 +339,14 @@
$tmp_docroot = explode('/',$data['old']['document_root']);
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);
--
Gitblit v1.9.1