Skip to content

Commit fb15d61

Browse files
committed
- Undone a change in modules.inc.php
- Chnegd installer to allow access from the slave hostname and IP address to the master database.
1 parent 47f3533 commit fb15d61

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

install/lib/installer_base.lib.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,19 +227,25 @@ public function add_database_server_record() {
227227

228228
//* insert the ispconfig user in the remote server
229229
$from_host = $conf['hostname'];
230+
$from_ip = gethostbyname($conf['hostname']);
230231

231232
//* username for the ispconfig user
232233
$conf['mysql']['master_ispconfig_user'] = 'ispconfigserver'.$conf['server_id'];
233234

234-
//* Delete ISPConfig user in the local database, in case that it exists
235+
//* Delete ISPConfig user in the master database, in case that it exists
235236
$this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_host."';");
236237
$this->dbmaster->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['master_database']."' AND Host = '".$from_host."';");
238+
$this->dbmaster->query("DELETE FROM mysql.user WHERE User = '".$conf['mysql']['master_ispconfig_user']."' AND Host = '".$from_ip."';");
239+
$this->dbmaster->query("DELETE FROM mysql.db WHERE Db = '".$conf['mysql']['master_database']."' AND Host = '".$from_ip."';");
237240
$this->dbmaster->query('FLUSH PRIVILEGES;');
238241

239242
//* Create the ISPConfig database user in the local database
240243
$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['master_database'].".* "
241244
."TO '".$conf['mysql']['master_ispconfig_user']."'@'".$from_host."' "
242245
."IDENTIFIED BY '".$conf['mysql']['master_ispconfig_password']."';";
246+
$query = 'GRANT SELECT, INSERT, UPDATE, DELETE ON '.$conf['mysql']['master_database'].".* "
247+
."TO '".$conf['mysql']['master_ispconfig_user']."'@'".$from_ip."' "
248+
."IDENTIFIED BY '".$conf['mysql']['master_ispconfig_password']."';";
243249
if(!$this->dbmaster->query($query)) {
244250
$this->error('Unable to create database user in master database: '.$conf['mysql']['master_ispconfig_user'].' Error: '.$this->dbmaster->errorMessage);
245251
}

server/lib/classes/modules.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function processDatalog() {
8888
$records = $app->dbmaster->queryAllRecords($sql);
8989
foreach($records as $d) {
9090

91-
$data = unserialize($d["data"]);
91+
$data = unserialize(stripslashes($d["data"]));
9292
$replication_error = false;
9393

9494
$this->current_datalog_id = $d["datalog_id"];
@@ -164,7 +164,7 @@ function processDatalog() {
164164
$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";
165165
$records = $app->db->queryAllRecords($sql);
166166
foreach($records as $d) {
167-
$data = unserialize($d["data"]);
167+
$data = unserialize(stripslashes($d["data"]));
168168
$this->current_datalog_id = $d["datalog_id"];
169169
$this->raiseTableHook($d["dbtable"],$d["action"],$data);
170170
//$app->db->query("DELETE FROM sys_datalog WHERE datalog_id = ".$rec["datalog_id"]);

0 commit comments

Comments
 (0)