summaryrefslogtreecommitdiff
path: root/program/include/rcube_db_sqlite.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-07-09 19:57:50 +0200
committerAleksander Machniak <alec@alec.pl>2012-07-09 19:57:50 +0200
commit146106a827b84fa3342fb7afef5919b94c10a797 (patch)
tree7f3a755a3fbea753cbc9a269fa42092aab7692fc /program/include/rcube_db_sqlite.php
parent329eae0abd8fd3297e90577d7922864ce8078571 (diff)
Support sqlite file mode setting
Diffstat (limited to 'program/include/rcube_db_sqlite.php')
-rw-r--r--program/include/rcube_db_sqlite.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/program/include/rcube_db_sqlite.php b/program/include/rcube_db_sqlite.php
index 57f8ddc2a..a9774cd51 100644
--- a/program/include/rcube_db_sqlite.php
+++ b/program/include/rcube_db_sqlite.php
@@ -45,7 +45,12 @@ class rcube_db_sqlite extends rcube_db
{
// Create database file, required by PDO to exist on connection
if (!empty($dsn['database']) && !file_exists($dsn['database'])) {
- touch($dsn['database']);
+ $created = touch($dsn['database']);
+
+ // File mode setting, for compat. with MDB2
+ if (!empty($dsn['mode']) && $created) {
+ chmod($dsn['database'], octdec($dsn['mode']));
+ }
}
}
@@ -68,7 +73,7 @@ class rcube_db_sqlite extends rcube_db
$q = $dbh->exec($data);
if ($q === false) {
- $error = $this->dbh->errorInfo();
+ $error = $dbh->errorInfo();
$this->db_error = true;
$this->db_error_msg = sprintf('[%s] %s', $error[1], $error[2]);