From fb66b7870bce2b5f04cbaee82042b016b0de46b5 Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Wed, 17 Dec 2008 08:05:19 -0500 Subject: [PATCH] - Added Warning message when network configuration is disabled. - Added some general php settings to config.inc.php --- server/lib/classes/modules.inc.php | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/server/lib/classes/modules.inc.php b/server/lib/classes/modules.inc.php index 542ebef..2da4f24 100644 --- a/server/lib/classes/modules.inc.php +++ b/server/lib/classes/modules.inc.php @@ -82,14 +82,13 @@ function processDatalog() { global $app,$conf; - // TODO: process only new entries. //* If its a multiserver setup if($app->db->dbHost != $app->dbmaster->dbHost) { $sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0) ORDER BY datalog_id"; $records = $app->dbmaster->queryAllRecords($sql); foreach($records as $d) { - $data = unserialize(stripslashes($d["data"])); + $data = unserialize($d["data"]); $replication_error = false; $this->current_datalog_id = $d["datalog_id"]; @@ -106,11 +105,11 @@ $tmp_sql2 = substr($tmp_sql2,0,-1); //$tmp_sql1 .= "$idx[0]"; //$tmp_sql2 .= "$idx[1]"; - $sql = "INSERT INTO $d[dbtable] ($tmp_sql1) VALUES ($tmp_sql2)"; + $sql = "REPLACE INTO $d[dbtable] ($tmp_sql1) VALUES ($tmp_sql2)"; $app->db->query($sql); if($app->db->errorNumber > 0) { $replication_error = true; - $app->log("Replication failed. Error: ".$app->db->errorMessage,LOGLEVEL_ERROR); + $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR); } $app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG); } @@ -126,7 +125,7 @@ $app->db->query($sql); if($app->db->errorNumber > 0) { $replication_error = true; - $app->log("Replication failed. Error: ".$app->db->errorMessage,LOGLEVEL_ERROR); + $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR); } $app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG); } @@ -138,7 +137,7 @@ $app->db->query($sql); if($app->db->errorNumber > 0) { $replication_error = true; - $app->log("Replication failed. Error: ".$app->db->errorMessage,LOGLEVEL_ERROR); + $app->log("Replication failed. Error: (" . $d[dbtable] . ") " . $app->db->errorMessage . " # SQL: " . $sql,LOGLEVEL_ERROR); } $app->log("Replicated from master: ".$sql,LOGLEVEL_DEBUG); } @@ -151,7 +150,12 @@ $app->dbmaster->query("UPDATE server SET updated = ".$d["datalog_id"]." WHERE server_id = ".$conf["server_id"]); $app->log("Processed datalog_id ".$d["datalog_id"],LOGLEVEL_DEBUG); } else { - $app->log("Error in Repliction, changes were not processed.",LOGLEVEL_ERROR); + $app->log("Error in Replication, changes were not processed.",LOGLEVEL_ERROR); + /* + * If there is any error in processing the datalog we can't continue, because + * we do not know if the newer actions require this (old) one. + */ + return; } } @@ -160,7 +164,7 @@ $sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0) ORDER BY datalog_id"; $records = $app->db->queryAllRecords($sql); foreach($records as $d) { - $data = unserialize(stripslashes($d["data"])); + $data = unserialize($d["data"]); $this->current_datalog_id = $d["datalog_id"]; $this->raiseTableHook($d["dbtable"],$d["action"],$data); //$app->db->query("DELETE FROM sys_datalog WHERE datalog_id = ".$rec["datalog_id"]); -- Gitblit v1.9.1