From f290aeee63eb27310b71533ca497e74a08401f31 Mon Sep 17 00:00:00 2001 From: Tiago Peralta Date: Sun, 10 Dec 2017 20:22:58 +0000 Subject: [PATCH] Small bugfix to not validate the Slave when it's not enabled --- include/classes/mysqlims.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/classes/mysqlims.class.php b/include/classes/mysqlims.class.php index b4537610..26d02e57 100644 --- a/include/classes/mysqlims.class.php +++ b/include/classes/mysqlims.class.php @@ -6,6 +6,7 @@ class mysqlims extends mysqli { private $mysqliW; private $mysqliR = null; + private $slave = false; /* * Pass main and slave connection arrays to the constructor, and strict as true/false @@ -27,6 +28,7 @@ class mysqlims extends mysqli $this->mysqliR = new mysqli_strict($slave['host'], $slave['user'], $slave['pass'], $slave['name'], $slave['port']); + $this->slave = true; } } else { $this->mysqliW = new mysqli($main['host'], @@ -37,6 +39,7 @@ class mysqlims extends mysqli $this->mysqliR = new mysqli($slave['host'], $slave['user'], $slave['pass'], $slave['name'], $slave['port']); + $this->slave = true; } } @@ -44,7 +47,7 @@ class mysqlims extends mysqli throw new Exception("Failed to connect to MySQL: (".$this->mysqliW->connect_errno.") ".$this->mysqliW->connect_error); } - if ($this->mysqliR->connect_errno) { + if ($this->mysqliR->connect_errno && $this->slave === true) { throw new Exception("Failed to connect to MySQL: (".$this->mysqliR->connect_errno.") ".$this->mysqliR->connect_error); } }