From db4ec58b9086d55dfd22366850e21486fc5211e6 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 05 Dec 2011 02:24:36 -0500
Subject: [PATCH] - Apply fixes from trunk up to r5542
---
program/include/rcube_mdb2.php | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 3b7a612..f166967 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -91,6 +91,8 @@
$db_options['disable_smart_seqname'] = true;
$db_options['seqname_format'] = '%s';
}
+ $this->db_error = false;
+ $this->db_error_msg = null;
$dbh = MDB2::connect($dsn, $db_options);
@@ -145,6 +147,13 @@
$this->db_handle = $this->dsn_connect($dsn);
$this->db_connected = !PEAR::isError($this->db_handle);
+ // use write-master when read-only fails
+ if (!$this->db_connected && $mode == 'r') {
+ $mode = 'w';
+ $this->db_handle = $this->dsn_connect($this->db_dsnw);
+ $this->db_connected = !PEAR::isError($this->db_handle);
+ }
+
if ($this->db_connected)
$this->db_mode = $mode;
else
--
Gitblit v1.9.1