diff options
author | Frédéric Guillot <fred@kanboard.net> | 2018-01-11 14:01:32 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2018-01-11 14:01:32 -0800 |
commit | d35d5beee216ea0a092dac88e9b7556faa95372e (patch) | |
tree | 30098b2b885a445240e628894ceb7021d0fb02f6 /vendor/fguillot/picodb/lib | |
parent | f7c6cbd0f41434afd8940bc54498b85d6d19e31c (diff) |
Add option to disable Mysql SSL server verification
Diffstat (limited to 'vendor/fguillot/picodb/lib')
-rw-r--r-- | vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php | 8 | ||||
-rw-r--r-- | vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php | 19 | ||||
-rw-r--r-- | vendor/fguillot/picodb/lib/PicoDb/Table.php | 8 |
3 files changed, 30 insertions, 5 deletions
diff --git a/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php b/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php index 4f3ca64e..147be816 100644 --- a/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php +++ b/vendor/fguillot/picodb/lib/PicoDb/Driver/Mysql.php @@ -98,6 +98,14 @@ class Mysql extends Base $options[PDO::MYSQL_ATTR_SSL_CA] = $settings['ssl_ca']; } + if (! empty($settings['persistent'])) { + $options[PDO::ATTR_PERSISTENT] = $settings['persistent']; + } + + if (isset($settings['verify_server_cert'])) { + $options[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = $settings['verify_server_cert']; + } + return $options; } diff --git a/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php b/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php index a494cdca..4a589e87 100644 --- a/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php +++ b/vendor/fguillot/picodb/lib/PicoDb/Driver/Postgres.php @@ -20,9 +20,6 @@ class Postgres extends Base * @var array */ protected $requiredAttributes = array( - 'hostname', - 'username', - 'password', 'database', ); @@ -42,13 +39,25 @@ class Postgres extends Base */ public function createConnection(array $settings) { - $dsn = 'pgsql:host='.$settings['hostname'].';dbname='.$settings['database']; + $dsn = 'pgsql:dbname='.$settings['database']; + + if (! empty($settings['username'])) { + $dsn .= ';user='.$settings['username']; + } + + if (! empty($settings['password'])) { + $dsn .= ';password='.$settings['password']; + } + + if (! empty($settings['hostname'])) { + $dsn .= ';host='.$settings['hostname']; + } if (! empty($settings['port'])) { $dsn .= ';port='.$settings['port']; } - $this->pdo = new PDO($dsn, $settings['username'], $settings['password']); + $this->pdo = new PDO($dsn); if (isset($settings['schema_table'])) { $this->schemaTable = $settings['schema_table']; diff --git a/vendor/fguillot/picodb/lib/PicoDb/Table.php b/vendor/fguillot/picodb/lib/PicoDb/Table.php index 09eb928e..404b5cbe 100644 --- a/vendor/fguillot/picodb/lib/PicoDb/Table.php +++ b/vendor/fguillot/picodb/lib/PicoDb/Table.php @@ -718,4 +718,12 @@ class Table call_user_func_array(array($this->conditionBuilder, $name), $arguments); return $this; } + + /** + * Clone function ensures that cloned objects are really clones + */ + public function __clone() + { + $this->conditionBuilder = clone $this->conditionBuilder; + } } |