diff options
author | alecpl <alec@alec.pl> | 2011-12-05 07:24:36 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-12-05 07:24:36 +0000 |
commit | db4ec58b9086d55dfd22366850e21486fc5211e6 (patch) | |
tree | 1946ba1f33116602a0a9a42da34cc36d1d8e80d8 /program/include | |
parent | f47d5e20891305d4c40f4f500318cfcbea4d2135 (diff) |
- Apply fixes from trunk up to r5542
Diffstat (limited to 'program/include')
-rw-r--r-- | 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 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 |