From c3bf39efc438d869645049e17549c9644a5467c2 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Mon, 20 Aug 2012 09:34:47 -0400
Subject: [PATCH] Changes for subdomain vhosts: - Fixed missing templates and language entries - Previous subdomain mode can be used concurrently - Changed log path to a more convenient location

---
 server/plugins-available/apache2_plugin.inc.php |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index a861265..bd1b1c1 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -328,8 +328,12 @@
         $web_folder = 'web';
         $log_folder = 'log';
         if($data['new']['type'] == 'vhostsubdomain') {
+            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
             $web_folder = $data['new']['web_folder'];
-            $log_folder .= '_web' . $data['new']['domain_id'];
+            $log_folder .= '/' . $subdomain_host;
+            unset($tmp);
         }
 
 		// Create group and user, if not exist
@@ -471,7 +475,7 @@
         if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
-			$app->system->mkdir($data['new']['document_root'].'/'.$log_folder);
+			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
 			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
 			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);

--
Gitblit v1.9.1