summaryrefslogtreecommitdiffstats
path: root/lib/private/db
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-10-29 17:23:27 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2014-11-25 16:29:06 +0100
commita6c088a1ef1ff8f1e1161ab9a61d8f1e57231b15 (patch)
tree8aad1443184cd2b519a2062be1df7c357fb48379 /lib/private/db
parent6fb2477fb75d4c982a1568e2392d17fd7cc2fd4b (diff)
downloadnextcloud-server-a6c088a1ef1ff8f1e1161ab9a61d8f1e57231b15.tar.gz
nextcloud-server-a6c088a1ef1ff8f1e1161ab9a61d8f1e57231b15.zip
adding new config parameter for sqlite to specify the journal mode
Diffstat (limited to 'lib/private/db')
-rw-r--r--lib/private/db/connectionfactory.php4
-rw-r--r--lib/private/db/sqlitesessioninit.php10
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/db/connectionfactory.php b/lib/private/db/connectionfactory.php
index f6253e09b95..58043b30440 100644
--- a/lib/private/db/connectionfactory.php
+++ b/lib/private/db/connectionfactory.php
@@ -90,7 +90,8 @@ class ConnectionFactory {
$eventManager->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\OracleSessionInit);
break;
case 'sqlite3':
- $eventManager->addEventSubscriber(new SQLiteSessionInit);
+ $journalMode = $additionalConnectionParams['sqlite.journal_mode'];
+ $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode));
break;
}
$connection = \Doctrine\DBAL\DriverManager::getConnection(
@@ -153,6 +154,7 @@ class ConnectionFactory {
}
$connectionParams['tablePrefix'] = $config->getSystemValue('dbtableprefix', 'oc_');
+ $connectionParams['sqlite.journal_mode'] = $config->getSystemValue('sqlite.journal_mode', 'WAL');
//additional driver options, eg. for mysql ssl
$driverOptions = $config->getSystemValue('dbdriveroptions', null);
diff --git a/lib/private/db/sqlitesessioninit.php b/lib/private/db/sqlitesessioninit.php
index 7e1166be95b..1fff22b883a 100644
--- a/lib/private/db/sqlitesessioninit.php
+++ b/lib/private/db/sqlitesessioninit.php
@@ -19,12 +19,19 @@ class SQLiteSessionInit implements EventSubscriber {
private $caseSensitiveLike;
/**
+ * @var string
+ */
+ private $journalMode;
+
+ /**
* Configure case sensitive like for each connection
*
* @param bool $caseSensitiveLike
+ * @param string $journalMode
*/
- public function __construct($caseSensitiveLike = true) {
+ public function __construct($caseSensitiveLike, $journalMode) {
$this->caseSensitiveLike = $caseSensitiveLike;
+ $this->journalMode = $journalMode;
}
/**
@@ -34,6 +41,7 @@ class SQLiteSessionInit implements EventSubscriber {
public function postConnect(ConnectionEventArgs $args) {
$sensitive = ($this->caseSensitiveLike) ? 'true' : 'false';
$args->getConnection()->executeUpdate('PRAGMA case_sensitive_like = ' . $sensitive);
+ $args->getConnection()->executeUpdate('PRAGMA journal_mode = ' . $this->journalMode);
}
public function getSubscribedEvents() {