From 526b997c9891a796b152cdbab8e329b356b1f596 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Fri, 22 Feb 2013 08:59:02 -0500
Subject: [PATCH] Merged revisions 3803-3844 from stable branch.

---
 interface/web/sites/web_domain_edit.php |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index c714fa3..b21b1c8 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -832,7 +832,7 @@
 
 		}
 
-		//* If the domain name has been changed, we will have to change all subdomains
+		//* If the domain name has been changed, we will have to change all subdomains + APS instances
 		if(!empty($this->dataRecord["domain"]) && !empty($this->oldDataRecord["domain"]) && $this->dataRecord["domain"] != $this->oldDataRecord["domain"]) {
 			$records = $app->db->queryAllRecords("SELECT domain_id,domain FROM web_domain WHERE (type = 'subdomain' OR type = 'vhostsubdomain') AND domain LIKE '%.".$app->db->quote($this->oldDataRecord["domain"])."'");
 			foreach($records as $rec) {
@@ -842,6 +842,18 @@
 			unset($records);
 			unset($rec);
 			unset($subdomain);
+			
+			// Update APS instances
+			$records = $app->db->queryAllRecords("SELECT id, instance_id FROM aps_instances_settings WHERE name = 'main_domain' AND value = '".$this->oldDataRecord["domain"]."'");
+			if(is_array($records) && !empty($records)){
+				foreach($records as $rec){
+					$app->db->datalogUpdate('aps_instances_settings', "value = '".$this->dataRecord["domain"]."'", 'id', $rec['id']);
+					// Reinstall of package needed?
+					//$app->db->datalogUpdate('aps_instances', "instance_status = '1'", 'id', $rec['instance_id']);
+				}
+			}
+			unset($records);
+			unset($rec);
 		}
 
 		//* Set allow_override if empty

--
Gitblit v1.9.1