From 61377e2e7a4c993bdbd5b090919ab5c297acf498 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 22 Jul 2009 11:45:44 -0400
Subject: [PATCH] Fixed a problem in database replication of multiserver setups. Added a missing language string in server config form.
---
install/install.php | 2 +-
server/lib/classes/db_mysql.inc.php | 4 ++--
server/lib/classes/modules.inc.php | 4 +++-
interface/web/admin/lib/lang/en_server_config.lng | 1 +
server/lib/app.inc.php | 5 +++++
5 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/install/install.php b/install/install.php
index 4378fd7..15defd6 100644
--- a/install/install.php
+++ b/install/install.php
@@ -358,7 +358,7 @@
}
//** Configure Apache
- swriteln("\nHint: If this server shall run the ispconfig interface, select 'y' in the next option.\n");
+ swriteln("\nHint: If this server shall run the ispconfig interface, select 'y' in the 'Configure Apache Server' option.\n");
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
$conf['services']['web'] = true;
swriteln('Configuring Apache');
diff --git a/interface/web/admin/lib/lang/en_server_config.lng b/interface/web/admin/lib/lang/en_server_config.lng
index 47b2d70..4793728 100644
--- a/interface/web/admin/lib/lang/en_server_config.lng
+++ b/interface/web/admin/lib/lang/en_server_config.lng
@@ -45,4 +45,5 @@
$wb["wget_txt"] = 'Path to wget program';
$wb["web_user_txt"] = 'Apache user';
$wb["web_group_txt"] = 'Apache group';
+$wb["security_level"] = 'Security level';
?>
\ No newline at end of file
diff --git a/server/lib/app.inc.php b/server/lib/app.inc.php
index e0ac82f..0fe0b8e 100644
--- a/server/lib/app.inc.php
+++ b/server/lib/app.inc.php
@@ -40,6 +40,11 @@
if($conf["start_db"] == true) {
$this->load('db_'.$conf["db_type"]);
$this->db = new db;
+ if($this->db->linkId) $this->db->closeConn();
+ $this->db->dbHost = $conf["db_host"];
+ $this->db->dbName = $conf["db_database"];
+ $this->db->dbUser = $conf["db_user"];
+ $this->db->dbPass = $conf["db_password"];
/*
Initialize the connection to the master DB,
diff --git a/server/lib/classes/db_mysql.inc.php b/server/lib/classes/db_mysql.inc.php
index 672de7f..986aa81 100644
--- a/server/lib/classes/db_mysql.inc.php
+++ b/server/lib/classes/db_mysql.inc.php
@@ -59,8 +59,8 @@
function updateError($location)
{
global $app;
- $this->errorNumber = mysql_errno();
- $this->errorMessage = mysql_error();
+ $this->errorNumber = mysql_errno($this->linkId);
+ $this->errorMessage = mysql_error($this->linkId);
$this->errorLocation = $location;
if($this->errorNumber && $this->show_error_messages && method_exists($app,'log'))
{
diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php
index e84595f..f4bb65c 100644
--- a/server/lib/classes/modules.inc.php
+++ b/server/lib/classes/modules.inc.php
@@ -118,10 +118,12 @@
//$tmp_sql1 .= "$idx[0]";
//$tmp_sql2 .= "$idx[1]";
$sql = "REPLACE INTO $d[dbtable] ($tmp_sql1) VALUES ($tmp_sql2)";
+ $app->db->errorNumber = 0;
+ $app->db->errorMessage = '';
$app->db->query($sql);
if($app->db->errorNumber > 0) {
$replication_error = true;
- $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
+ $app->log("Replication failed. Error: (" . $d[dbtable] . ") in mysql server: (".$app->db->dbHost.") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR);
}
$app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG);
}
--
Gitblit v1.9.1