From fc918d67e2a024211b0b2b34d642ae7514f5801c Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 13 Oct 2009 11:55:39 -0400
Subject: [PATCH] Fixed a bug in updater that caused the updater to fail on multiserver setups.

---
 install/update.php |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/install/update.php b/install/update.php
index 7285e58..e2ab869 100644
--- a/install/update.php
+++ b/install/update.php
@@ -144,10 +144,24 @@
 //* initialize the database
 $inst->db = new db();
 
+//* initialize the master DB, if we have a multiserver setup
+if($conf['mysql']['master_slave_setup'] == 'y') {
+	$inst->dbmaster = new db();
+	if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
+	$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
+	$inst->dbmaster->dbName = $conf['mysql']["master_database"];
+	$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
+	$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
+} else {
+	$inst->dbmaster = $inst->db;
+}
+
 //* Update $conf array with values from the server.ini that shall be preserved
 $tmp = $inst->db->queryOneRecord("SELECT * FROM ".$conf["mysql"]["database"].".server WHERE server_id = ".$conf['server_id']);
 $ini_array = ini_to_array(stripslashes($tmp['config']));
 
+if(count($ini_array) == 0) die('Unable to read server configuration from database.');
+
 $conf['services']['mail'] = ($tmp['mail_server'] == 1)?true:false;
 $conf['services']['web'] = ($tmp['web_server'] == 1)?true:false;
 $conf['services']['dns'] = ($tmp['dns_server'] == 1)?true:false;

--
Gitblit v1.9.1