summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-07-05 13:12:39 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2015-07-05 13:12:39 +0200
commit65acb2797f7b7b1d11e3a5d8390e8c5e6c87a00a (patch)
treef3068658a25017f14c29f157f9f303b55d9ed82d /lib
parentdcadf0dfdfb8730abdfdee2bbf061b984d5ef6b4 (diff)
parent92db9202980ce63ad6f437416efd50c07792e7e8 (diff)
Merge pull request #869 from Alkarex/PDOOptions
PDO options for e.g. SSL
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/ModelPdo.php10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php
index 3e8ec1f43..25999f02b 100644
--- a/lib/Minz/ModelPdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -53,21 +53,19 @@ class Minz_ModelPdo {
$this->current_user = $currentUser;
self::$sharedCurrentUser = $currentUser;
+ $driver_options = isset($conf->db['pdo_options']) && is_array($conf->db['pdo_options']) ? $conf->db['pdo_options'] : array();
+
try {
$type = $db['type'];
if ($type === 'mysql') {
$string = 'mysql:host=' . $db['host']
. ';dbname=' . $db['base']
. ';charset=utf8';
- $driver_options = array(
- PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
- );
+ $driver_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8';
$this->prefix = $db['prefix'] . $currentUser . '_';
} elseif ($type === 'sqlite') {
$string = 'sqlite:' . join_path(DATA_PATH, 'users', $currentUser, 'db.sqlite');
- $driver_options = array(
- //PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- );
+ //$driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$this->prefix = '';
} else {
throw new Minz_PDOConnectionException(