diff options
author | alecpl <alec@alec.pl> | 2011-12-02 13:32:28 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-12-02 13:32:28 +0000 |
commit | 69f00be516afa8f085d7cc384de9551abf5a7ffe (patch) | |
tree | 5941c084bdccd1545da8036117615eb542ac36f1 /program/include | |
parent | 4f8be46f38223c4e45ad966e977197e40e2eeb9a (diff) |
- Fallback to write-master when readonly database fails
Diffstat (limited to 'program/include')
-rw-r--r-- | 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 3b7a6129b..b1a019653 100644 --- a/program/include/rcube_mdb2.php +++ b/program/include/rcube_mdb2.php @@ -145,6 +145,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 |