summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-01-19 19:39:26 +0100
committerLukas Reschke <lukas@owncloud.com>2015-01-19 19:39:26 +0100
commitcbffaff7a00e9d029969d63f795d38a464448dfc (patch)
treef080f5a539e2cc601a0155eec122635030f739a8
parent6c1e13a6ed5ed725a06c62cc09a12acd62315790 (diff)
parentbaefefbbc81e76671943d377c7e49017f60d2432 (diff)
downloadnextcloud-server-cbffaff7a00e9d029969d63f795d38a464448dfc.tar.gz
nextcloud-server-cbffaff7a00e9d029969d63f795d38a464448dfc.zip
Merge pull request #13480 from owncloud/mysql-autocommit
set MySQL autocommit on connection setup
-rw-r--r--lib/private/db/connectionfactory.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/private/db/connectionfactory.php b/lib/private/db/connectionfactory.php
index 9c75baf887d..44b598dcda0 100644
--- a/lib/private/db/connectionfactory.php
+++ b/lib/private/db/connectionfactory.php
@@ -7,6 +7,9 @@
*/
namespace OC\DB;
+use Doctrine\DBAL\Event\Listeners\OracleSessionInit;
+use Doctrine\DBAL\Event\Listeners\SQLSessionInit;
+use Doctrine\DBAL\Event\Listeners\MysqlSessionInit;
/**
* Takes care of creating and configuring Doctrine connections.
@@ -84,10 +87,12 @@ class ConnectionFactory {
case 'mysql':
// Send "SET NAMES utf8". Only required on PHP 5.3 below 5.3.6.
// See http://stackoverflow.com/questions/4361459/php-pdo-charset-set-names#4361485
- $eventManager->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\MysqlSessionInit);
+ $eventManager->addEventSubscriber(new MysqlSessionInit);
+ $eventManager->addEventSubscriber(
+ new SQLSessionInit("SET SESSION AUTOCOMMIT=1"));
break;
case 'oci':
- $eventManager->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\OracleSessionInit);
+ $eventManager->addEventSubscriber(new OracleSessionInit);
break;
case 'sqlite3':
$journalMode = $additionalConnectionParams['sqlite.journal_mode'];
@@ -136,8 +141,8 @@ class ConnectionFactory {
$name = $config->getValue('dbname', 'owncloud');
if ($this->normalizeType($type) === 'sqlite3') {
- $datadir = $config->getValue("datadirectory", \OC::$SERVERROOT . '/data');
- $connectionParams['path'] = $datadir . '/' . $name . '.db';
+ $dataDir = $config->getValue("datadirectory", \OC::$SERVERROOT . '/data');
+ $connectionParams['path'] = $dataDir . '/' . $name . '.db';
} else {
$host = $config->getValue('dbhost', '');
if (strpos($host, ':')) {