From 69f00be516afa8f085d7cc384de9551abf5a7ffe Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 02 Dec 2011 08:32:28 -0500
Subject: [PATCH] - Fallback to write-master when readonly database fails
---
program/include/rcube_mdb2.php | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 3b7a612..b1a0196 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -145,6 +145,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