diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-10-29 17:23:27 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-11-25 16:29:06 +0100 |
commit | a6c088a1ef1ff8f1e1161ab9a61d8f1e57231b15 (patch) | |
tree | 8aad1443184cd2b519a2062be1df7c357fb48379 | |
parent | 6fb2477fb75d4c982a1568e2392d17fd7cc2fd4b (diff) | |
download | nextcloud-server-a6c088a1ef1ff8f1e1161ab9a61d8f1e57231b15.tar.gz nextcloud-server-a6c088a1ef1ff8f1e1161ab9a61d8f1e57231b15.zip |
adding new config parameter for sqlite to specify the journal mode
-rw-r--r-- | config/config.sample.php | 6 | ||||
-rw-r--r-- | lib/private/db/connectionfactory.php | 4 | ||||
-rw-r--r-- | lib/private/db/sqlitesessioninit.php | 10 | ||||
-rw-r--r-- | tests/preseed-config.php | 33 |
4 files changed, 34 insertions, 19 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 2287b7af7dd..bacde038b91 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -134,6 +134,12 @@ $CONFIG = array( ), /** + * sqlite3 journal mode can be specified using this config parameter - can be 'WAL' or 'DELETE' + * see for more details https://www.sqlite.org/wal.html + */ +'sqlite.journal_mode' => 'DELETE', + +/** * Indicates whether the ownCloud instance was installed successfully; ``true`` * indicates a successful installation, and ``false`` indicates an unsuccessful * installation. 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() { diff --git a/tests/preseed-config.php b/tests/preseed-config.php index 3fd5b3cb7fc..3f41573bf29 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -1,22 +1,21 @@ <?php $CONFIG = array ( - "appstoreenabled" => false, - 'apps_paths' => - array ( - 0 => - array ( - 'path' => OC::$SERVERROOT.'/apps', - 'url' => '/apps', - 'writable' => true, - ), - 1 => - array ( - 'path' => OC::$SERVERROOT.'/apps2', - 'url' => '/apps2', - 'writable' => false, - ) - ), - + "appstoreenabled" => false, + 'apps_paths' => + array ( + 0 => + array ( + 'path' => OC::$SERVERROOT.'/apps', + 'url' => '/apps', + 'writable' => true, + ), + 1 => + array ( + 'path' => OC::$SERVERROOT.'/apps2', + 'url' => '/apps2', + 'writable' => false, + ) + ), ); if(substr(strtolower(PHP_OS), 0, 3) == "win") { |