Fix DB Write test on SQLite database ("database is locked" error) (#7064)

Also fix so SQLite DSN with a relative path to the database file works in Installer
pull/7066/head
Aleksander Machniak 5 years ago
parent fa34e5ebcd
commit 2f928a516d

@ -4,6 +4,8 @@ CHANGELOG Roundcube Webmail
- Managesieve: Replace "Filter disabled" with "Filter enabled" (#7028) - Managesieve: Replace "Filter disabled" with "Filter enabled" (#7028)
- Managesieve: Fix so modifier type select wasn't hidden after hiding modifier select on header change - Managesieve: Fix so modifier type select wasn't hidden after hiding modifier select on header change
- Enigma: Add script to import keys from filesystem to the db storage (for multihost) - Enigma: Add script to import keys from filesystem to the db storage (for multihost)
- Installer: Fix DB Write test on SQLite database ("database is locked" error) (#7064)
- Installer: Fix so SQLite DSN with a relative path to the database file works in Installer
- Fix so type attribute on script tags is not used on HTML5 pages (#6975) - Fix so type attribute on script tags is not used on HTML5 pages (#6975)
- Fix unread count after purge on a folder that is not currently selected (#7051) - Fix unread count after purge on a folder that is not currently selected (#7051)
- Fix bug where Enter key didn't work on messages list in "List" layout (#7052) - Fix bug where Enter key didn't work on messages list in "List" layout (#7052)

@ -189,6 +189,9 @@ if ($db_working) {
// more database tests // more database tests
if ($db_working) { if ($db_working) {
// Using transactions to workaround SQLite bug (#7064)
$DB->startTransaction();
// write test // write test
$insert_id = md5(uniqid()); $insert_id = md5(uniqid());
$db_write = $DB->query("INSERT INTO " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session') $db_write = $DB->query("INSERT INTO " . $DB->quote_identifier($RCI->config['db_prefix'] . 'session')
@ -204,6 +207,9 @@ if ($db_working) {
} }
echo '<br />'; echo '<br />';
// Transaction end
$DB->rollbackTransaction();
// check timezone settings // check timezone settings
$tz_db = 'SELECT ' . $DB->unixtimestamp($DB->now()) . ' AS tz_db'; $tz_db = 'SELECT ' . $DB->unixtimestamp($DB->now()) . ' AS tz_db';
$tz_db = $DB->query($tz_db); $tz_db = $DB->query($tz_db);

@ -1258,6 +1258,15 @@ class rcube_db
// remove problematic suffix (#7034) // remove problematic suffix (#7034)
$parsed['database'] = preg_replace('/;.*$/', '', $parsed['database']); $parsed['database'] = preg_replace('/;.*$/', '', $parsed['database']);
// Resolve relative path to the sqlite database file
// so for example it works with Roundcube Installer
if (!empty($parsed['phptype']) && !empty($parsed['database'])
&& stripos($parsed['phptype'], 'sqlite') === 0
&& $parsed['database'][0] != '/'
) {
$parsed['database'] = INSTALL_PATH . $parsed['database'];
}
} }
return $parsed; return $parsed;

Loading…
Cancel
Save