diff --git a/config/config.sample.php b/config/config.sample.php index 104b3e325461d..3e65008ed3bc3 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -138,6 +138,12 @@ */ 'dbtableprefix' => '', +/** + * Enable persistent connexions to the database. + * This setting uses the "persistent" option from doctrine dbal, wich in turns + * uses the PDO::ATTR_PERSISTENT option from de pdo driver. + */ +'dbpersistent' => '', /** * Indicates whether the Nextcloud instance was installed successfully; ``true`` diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php index 95f3185bcdb17..1b0ac4363647a 100644 --- a/lib/private/DB/ConnectionFactory.php +++ b/lib/private/DB/ConnectionFactory.php @@ -233,6 +233,10 @@ public function createConnectionParams(string $configPrefix = '') { ]; } + if ($this->config->getValue('dbpersistent', false)) { + $connectionParams['persistent'] = true; + } + return $connectionParams; }