summaryrefslogtreecommitdiff
path: root/program/include/rcube_mdb2.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/rcube_mdb2.php')
-rw-r--r--program/include/rcube_mdb2.php9
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