]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding new config parameter for sqlite to specify the journal mode
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 29 Oct 2014 16:23:27 +0000 (17:23 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 25 Nov 2014 15:29:06 +0000 (16:29 +0100)
config/config.sample.php
lib/private/db/connectionfactory.php
lib/private/db/sqlitesessioninit.php
tests/preseed-config.php

index 2287b7af7ddfe7fbcde6ce0041c9e12898c2f189..bacde038b915f92c8aef4127e19edb4dcfbb07b1 100644 (file)
@@ -133,6 +133,12 @@ $CONFIG = array(
        PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem',
 ),
 
+/**
+ * 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
index f6253e09b951290ae4e2f2659ac656ca770394b2..58043b3044037cc502fb704457cb37f6196b94f8 100644 (file)
@@ -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);
index 7e1166be95b2caf7e14fba5de80bfa73a67fad27..1fff22b883a644e7e520046a4a11447eac8d1fec 100644 (file)
@@ -18,13 +18,20 @@ 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() {
index 3fd5b3cb7fc72007e553947326048e5b38376b2a..3f41573bf2954478b6d34bdb3ecc3750a3a7be53 100644 (file)
@@ -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") {