From bc2c02feec27126488005624b26c6a14df7956b7 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 17 Feb 2013 04:52:45 -0500
Subject: [PATCH] When connection to read-only db fails try to connect to write-master, but only if it is defined

---
 program/lib/Roundcube/rcube_db.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php
index a3475a2..88cd22b 100644
--- a/program/lib/Roundcube/rcube_db.php
+++ b/program/lib/Roundcube/rcube_db.php
@@ -222,7 +222,7 @@
         $this->db_connected = is_object($this->dbh);
 
         // use write-master when read-only fails
-        if (!$this->db_connected && $mode == 'r') {
+        if (!$this->db_connected && $mode == 'r' && $this->is_replicated()) {
             $mode = 'w';
             $this->dbh          = $this->dsn_connect($this->db_dsnw_array);
             $this->db_connected = is_object($this->dbh);

--
Gitblit v1.9.1