diff --git a/CHANGELOG b/CHANGELOG
index e1dca5735..03a731a77 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Add new DB abstraction layer based on PHP PDO, supporting SQLite3 (#1488332)
- Fix handling of unitless CSS size values in HTML message (#1488535)
- Fix removing contact photo using LDAP addressbook (#1488420)
- Fix storing X-ANNIVERSARY date in vCard format (#1488527)
diff --git a/bin/update.sh b/bin/update.sh
index 60dc95b9d..83dd4a196 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -137,7 +137,7 @@ if ($RCI->configured) {
// check database schema
if ($RCI->config['db_dsnw']) {
- $DB = new rcube_mdb2($RCI->config['db_dsnw'], '', false);
+ $DB = new rcube_db::factory($RCI->config['db_dsnw'], '', false);
$DB->db_connect('w');
if ($db_error_msg = $DB->is_error()) {
echo "Error connecting to database: $db_error_msg\n";
diff --git a/installer/check.php b/installer/check.php
index e5f30261c..3136563b1 100644
--- a/installer/check.php
+++ b/installer/check.php
@@ -6,7 +6,8 @@ $required_php_exts = array(
'DOM' => 'dom',
'Session' => 'session',
'XML' => 'xml',
- 'JSON' => 'json'
+ 'JSON' => 'json',
+ 'PDO' => 'PDO',
);
$optional_php_exts = array(
@@ -21,19 +22,11 @@ $optional_php_exts = array(
$required_libs = array(
'PEAR' => 'PEAR.php',
- 'MDB2' => 'MDB2.php',
'Net_SMTP' => 'Net/SMTP.php',
'Net_IDNA2' => 'Net/IDNA2.php',
'Mail_mime' => 'Mail/mime.php',
);
-$supported_dbs = array(
- 'MySQL' => 'mysql',
- 'MySQLi' => 'mysqli',
- 'PostgreSQL' => 'pgsql',
- 'SQLite (v2)' => 'sqlite',
-);
-
$ini_checks = array(
'file_uploads' => 1,
'session.auto_start' => 0,
@@ -61,8 +54,14 @@ $source_urls = array(
'DOM' => 'http://www.php.net/manual/en/book.dom.php',
'Intl' => 'http://www.php.net/manual/en/book.intl.php',
'Exif' => 'http://www.php.net/manual/en/book.exif.php',
+ 'PDO' => 'http://www.php.net/manual/en/book.pdo.php',
+ 'pdo_mysql' => 'http://www.php.net/manual/en/book.pdo-mysql.php',
+ 'pdo_pgsql' => 'http://www.php.net/manual/en/book.pdo-pgsql.php',
+ 'pdo_sqlite' => 'http://www.php.net/manual/en/book.pdo-sqlite.php',
+ 'pdo_sqlite2' => 'http://www.php.net/manual/en/book.pdo-sqlite.php',
+ 'pdo_sqlsrv' => 'http://www.php.net/manual/en/book.pdo-sqlsrv.php',
+ 'pdo_dblib' => 'http://www.php.net/manual/en/book.pdo-dblib.php',
'PEAR' => 'http://pear.php.net',
- 'MDB2' => 'http://pear.php.net/package/MDB2',
'Net_SMTP' => 'http://pear.php.net/package/Net_SMTP',
'Mail_mime' => 'http://pear.php.net/package/Mail_mime',
'Net_IDNA2' => 'http://pear.php.net/package/Net_IDNA2',
@@ -127,14 +126,14 @@ foreach ($optional_php_exts as $name => $ext) {
$ext) {
+foreach ($RCI->supported_dbs as $database => $ext) {
if (extension_loaded($ext)) {
$RCI->pass($database);
}
else {
$_ext = $ext_dir . '/' . $prefix . $ext . '.' . PHP_SHLIB_SUFFIX;
- $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : 'Not installed';
- $RCI->na($database, $msg, $source_urls[$database]);
+ $msg = @is_readable($_ext) ? 'Could be loaded. Please add in php.ini' : '';
+ $RCI->na($database, $msg, $source_urls[$ext]);
}
echo '
';
}
diff --git a/installer/config.php b/installer/config.php
index bd676b12e..905fb06a3 100644
--- a/installer/config.php
+++ b/installer/config.php
@@ -267,13 +267,8 @@ echo $input_syslogfacility->show($RCI->getprop('syslog_facility'), LOG_USER);
Database settings for read/write operations:
'mysql', 'MySQLi' => 'mysqli', - 'PgSQL' => 'pgsql', 'SQLite' => 'sqlite'); - $select_dbtype = new html_select(array('name' => '_dbtype', 'id' => "cfgdbtype")); -foreach ($supported_dbs AS $database => $ext) { +foreach ($RCI->supported_dbs as $database => $ext) { if (extension_loaded($ext)) { $select_dbtype->add($database, $ext); } @@ -284,7 +279,7 @@ $input_dbname = new html_inputfield(array('name' => '_dbname', 'size' => 20, 'id $input_dbuser = new html_inputfield(array('name' => '_dbuser', 'size' => 20, 'id' => "cfgdbuser")); $input_dbpass = new html_passwordfield(array('name' => '_dbpass', 'size' => 20, 'id' => "cfgdbpass")); -$dsnw = MDB2::parseDSN($RCI->getprop('db_dsnw')); +$dsnw = rcube_db::parse_dsn($RCI->getprop('db_dsnw')); echo $select_dbtype->show($RCI->is_post ? $_POST['_dbtype'] : $dsnw['phptype']); echo ''; var_dump($diff); echo ''; - return false; - } - } - else - $this->raise_error(array('message' => "Could not find reference schema file ($ref_schema)")); - return false; - } - return false; + return $schema; } diff --git a/installer/test.php b/installer/test.php index 2dd330531..87896009c 100644 --- a/installer/test.php +++ b/installer/test.php @@ -125,9 +125,9 @@ else { $db_working = false; if ($RCI->configured) { if (!empty($RCI->config['db_dsnw'])) { - - $DB = new rcube_mdb2($RCI->config['db_dsnw'], '', false); + $DB = new rcube_db::factory($RCI->config['db_dsnw'], '', false); $DB->db_connect('w'); + if (!($db_error_msg = $DB->is_error())) { $RCI->pass('DSN (write)'); echo '