From db4ec58b9086d55dfd22366850e21486fc5211e6 Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 5 Dec 2011 07:24:36 +0000 Subject: - Apply fixes from trunk up to r5542 --- program/include/rcube_mdb2.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'program/include/rcube_mdb2.php') diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php index 3b7a6129b..f1669677c 100644 --- a/program/include/rcube_mdb2.php +++ b/program/include/rcube_mdb2.php @@ -91,6 +91,8 @@ class rcube_mdb2 $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 @@ class rcube_mdb2 $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 -- cgit v1.2.3