From 3fbdb9bd7b59e185fe7efd40c74f009bc4e97d2f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 04 Mar 2009 10:21:24 -0500
Subject: [PATCH] changed vhost.conf.master
---
server/plugins-available/apache2_plugin.inc.php | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 3a5cbda..555cffa 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -233,14 +233,15 @@
return 0;
}
+ //* If the client of the site has been changed, we have a change of the document root
if($this->action == 'update' && $data["new"]["document_root"] != $data["old"]["document_root"]) {
- // Get the old client ID
+ //* Get the old client ID
$old_client = $app->dbmaster->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($data["old"]["sys_groupid"]));
$old_client_id = intval($old_client["client_id"]);
unset($old_client);
- // Remove the old symlinks
+ //* Remove the old symlinks
$tmp_symlinks_array = explode(':',$web_config["website_symlinks"]);
if(is_array($tmp_symlinks_array)) {
foreach($tmp_symlinks_array as $tmp_symlink) {
@@ -256,6 +257,7 @@
}
}
+ //* Move the site data
$tmp_docroot = explode('/',$data["new"]["document_root"]);
unset($tmp_docroot[count($tmp_docroot)-1]);
$new_dir = implode('/',$tmp_docroot);
@@ -268,6 +270,13 @@
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);
+
+ //* Change the home directory and group of the website user
+ $command = 'usermod';
+ $command .= ' --home '.escapeshellcmd($data["new"]["document_root"]);
+ $command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
+ $command .= ' '.escapeshellcmd($data["new"]["system_user"]);
+ exec($command);
}
@@ -323,8 +332,8 @@
$tmp_symlink = str_replace("[website_domain]",$data["old"]["domain"],$tmp_symlink);
// Remove trailing slash
if(substr($tmp_symlink, -1, 1) == '/') $tmp_symlink = substr($tmp_symlink, 0, -1);
- // create the symlinks, if not exist
- if(!is_link($tmp_symlink)) {
+ // remove the symlinks, if not exist
+ if(is_link($tmp_symlink)) {
exec("rm -f ".escapeshellcmd($tmp_symlink));
$app->log("Removed Symlink: rm -f ".$tmp_symlink,LOGLEVEL_DEBUG);
}
--
Gitblit v1.9.1