From 1ba089d254117262571defacfe895c5a2491b832 Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Thu, 11 Feb 2016 11:28:10 -0500
Subject: [PATCH] - letsencrypt update from upstream

---
 server/plugins-available/apache2_plugin.inc.php |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index 76528c2..e0564cf 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1121,6 +1121,7 @@
 			|| ($data['old']['domain'] != $data['new']['domain']) // we have domain update
 			|| ($data['old']['subdomain'] != $data['new']['subdomain']) // we have new or update on "auto" subdomain
 			|| ($data['new']['type'] == 'subdomain') // we have new or update on subdomain
+			|| ($data['old']['type'] == 'alias' || $data['new']['type'] == 'alias') // we have new or update on aliasdomain
 		)) {
 			if(substr($domain, 0, 2) === '*.') {
 				// wildcard domain not yet supported by letsencrypt!
@@ -1135,6 +1136,7 @@
 			$temp_domains = array();
 			$lddomain = $domain;
 			$subdomains = null;
+			$aliasdomains = null;
 
 			//* be sure to have good domain
 			if($data['new']['subdomain'] == "www" OR $data['new']['subdomain'] == "*") {
@@ -1148,6 +1150,17 @@
 					$temp_domains[] = $subdomain['domain'];
 				}
 			}
+			
+			//* then, add alias domain if we have
+			$aliasdomains = $app->db->queryAllRecords('SELECT domain,subdomain FROM web_domain WHERE parent_domain_id = '.intval($data['new']['domain_id'])." AND active = 'y' AND type = 'alias'");
+			if(is_array($aliasdomains)) {
+				foreach($aliasdomains as $aliasdomain) {
+					$temp_domains[] = $aliasdomain['domain'];
+					if(isset($aliasdomain['subdomain']) && ! empty($aliasdomain['subdomain'])) {
+						$temp_domains[] = $aliasdomain['subdomain'] . "." . $aliasdomain['domain'];
+					}
+				}
+			}
 
 			// prevent duplicate
 			$temp_domains = array_unique($temp_domains);

--
Gitblit v1.9.1