From be9aacaa5296dfca63fb3a01c2dc52538d1546aa Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Sat, 17 Nov 2012 12:31:31 -0500
Subject: [PATCH] Bring back lost localization for the about page

---
 program/include/rcube_db_sqlite.php |   40 +++++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/program/include/rcube_db_sqlite.php b/program/include/rcube_db_sqlite.php
index fe6b0dc..9aa67d0 100644
--- a/program/include/rcube_db_sqlite.php
+++ b/program/include/rcube_db_sqlite.php
@@ -1,6 +1,6 @@
 <?php
 
-/*
+/**
  +-----------------------------------------------------------------------+
  | program/include/rcube_db_sqlite.php                                   |
  |                                                                       |
@@ -23,27 +23,41 @@
 
 /**
  * Database independent query interface
- *
  * This is a wrapper for the PHP PDO
  *
- * @package    Database
- * @version    1.0
+ * @package    Framework
+ * @subpackage Database
  */
 class rcube_db_sqlite extends rcube_db
 {
+    public $db_provider = 'sqlite';
 
+    /**
+     * Database character set
+     */
     protected function set_charset($charset)
     {
     }
 
+    /**
+     * Prepare connection
+     */
     protected function conn_prepare($dsn)
     {
         // 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']));
+            }
         }
     }
 
+    /**
+     * Configure connection, create database if not exists
+     */
     protected function conn_configure($dsn, $dbh)
     {
         // we emulate via callback some missing functions
@@ -55,14 +69,12 @@
             $data = file_get_contents(INSTALL_PATH . 'SQL/sqlite.initial.sql');
 
             if (strlen($data)) {
-                if ($this->options['debug_mode']) {
-                    $this::debug('INITIALIZE DATABASE');
-                }
+                $this->debug('INITIALIZE DATABASE');
 
                 $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]);
 
@@ -73,7 +85,6 @@
             }
         }
     }
-
 
     /**
      * Callback for sqlite: unix_timestamp()
@@ -94,7 +105,6 @@
         return $ret;
     }
 
-
     /**
      * Callback for sqlite: now()
      */
@@ -102,7 +112,6 @@
     {
         return date("Y-m-d H:i:s");
     }
-
 
     /**
      * Returns list of tables in database
@@ -126,11 +135,10 @@
         return $this->tables;
     }
 
-
     /**
      * Returns list of columns in database table
      *
-     * @param string Table name
+     * @param string $table Table name
      *
      * @return array List of table cols
      */
@@ -161,7 +169,9 @@
         return $columns;
     }
 
-
+    /**
+     * Build DSN string for PDO constructor
+     */
     protected function dsn_string($dsn)
     {
         return $dsn['phptype'] . ':' . $dsn['database'];

--
Gitblit v1.9.1