From f1926a01df8871cdacb29c97ffbfd7ff18d1610a Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Tue, 09 Feb 2016 11:56:40 -0500
Subject: [PATCH] Fixed problems that prevented ISPConfig to run on PHP 7, Issue #3716

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

diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php
index 320f3d0..d5d5dc8 100644
--- a/server/plugins-available/apps_vhost_plugin.inc.php
+++ b/server/plugins-available/apps_vhost_plugin.inc.php
@@ -119,6 +119,16 @@
 			/* end of backwards compatibility section */
 
 			$app->system->file_put_contents("$vhost_conf_dir/apps.vhost", $content);
+
+			// enabled / disable apps-vhost
+			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/000-apps.vhost');
+			if(is_link($vhost_symlink) && $web_config['apps_vhost_enabled'] == 'n') {
+				$app->system->unlink($vhost_symlink);
+			}
+			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost') && $web_config['apps_vhost_enabled'] == 'y') {
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
+			}
+
 			$app->services->restartServiceDelayed('httpd', 'restart');
 		}
 
@@ -185,6 +195,16 @@
 			file_put_contents($web_config['php_fpm_pool_dir'].'/apps.conf', $fpm_content);
 
 			file_put_contents("$vhost_conf_dir/apps.vhost", $content);
+
+			// enabled / disable apps-vhost
+			$vhost_symlink = escapeshellcmd($web_config['vhost_conf_enabled_dir'].'/000-apps.vhost');
+			if(is_link($vhost_symlink) && $web_config['apps_vhost_enabled'] == 'n') {
+				$app->system->unlink($vhost_symlink);
+			}
+			if(!@is_link($vhost_conf_enabled_dir.'/000-apps.vhost') && $web_config['apps_vhost_enabled'] == 'y') {
+				symlink($vhost_conf_dir.'/apps.vhost', $vhost_conf_enabled_dir.'/000-apps.vhost');
+			}
+
 			$app->services->restartServiceDelayed('httpd', 'reload');
 		}
 	}

--
Gitblit v1.9.1