From f43ef975d75a57973886e7f8eabb068d2ac15cc0 Mon Sep 17 00:00:00 2001
From: Falko Timme <ft@falkotimme.com>
Date: Mon, 16 Jun 2014 12:06:06 -0400
Subject: [PATCH] - Make sure ISPConfig shows the correct error message (instad of an SQL error) when a website is renamed after an alias domain that still exists. - It should be possible to create two websites with the same domain on the same server as long as the IP differs. I therefore changed the serverdomain index of the web_domain table to include the IP address.

---
 install/lib/update.lib.php |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/install/lib/update.lib.php b/install/lib/update.lib.php
index 12231b2..52d4a3c 100644
--- a/install/lib/update.lib.php
+++ b/install/lib/update.lib.php
@@ -29,10 +29,10 @@
 
 //* Installer patch stub class
 class installer_patch_update {
-	protected function onBeforeSQL() {
+	public function onBeforeSQL() {
 	}
 
-	protected function onAfterSQL() {
+	public function onAfterSQL() {
 	}
 
 }
@@ -164,6 +164,9 @@
 			$next_db_version = intval($current_db_version + 1);
 			$sql_patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql';
 			$php_patch_filename = realpath(dirname(__FILE__).'/../').'/patches/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.php';
+			
+			// comma separated list of version numbers were a update has to be done silently
+			$silent_update_versions = '75';
 
 			if(is_file($sql_patch_filename)) {
 
@@ -186,10 +189,14 @@
 
 				//* Load patch file into database
 				if( !empty($conf["mysql"]["admin_password"]) ) {
-					system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
+					$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." -p".escapeshellarg($conf['mysql']['admin_password'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
 				} else {
-					system("mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename);
+					$cmd = "mysql --default-character-set=".escapeshellarg($conf['mysql']['charset'])." --force -h ".escapeshellarg($conf['mysql']['host'])." -u ".escapeshellarg($conf['mysql']['admin_user'])." ".escapeshellarg($conf['mysql']['database'])." < ".$sql_patch_filename;
 				}
+				
+				if(in_array($next_db_version,explode(',',$silent_update_versions))) $cmd .= ' > /dev/null 2> /dev/null';
+				system($cmd);
+				
 				swriteln($inst->lng('Loading SQL patch file').': '.$sql_patch_filename);
 
 				//* Exec onAfterSQL function

--
Gitblit v1.9.1