Skip to content
Snippets Groups Projects
Commit ded52c26 authored by Jean-Laurent DUZANT's avatar Jean-Laurent DUZANT Committed by Guillaume Heurtier
Browse files

FEAT #23832 TIME 0:20 manage database redondant

parent c0205c57
No related branches found
No related tags found
No related merge requests found
......@@ -4,14 +4,16 @@
"timezone": "Europe/Paris",
"customLangPathDirectory": ""
},
"database": {
"server": "localhost",
"port": "5432",
"type": "POSTGRESQL",
"name": "maarch",
"user": "maarch",
"password": "maarch"
},
"databases": [
{
"server": "localhost",
"port": "5432",
"type": "POSTGRESQL",
"name": "maarch",
"user": "maarch",
"password": "maarch"
}
],
"electronicSignature": {
"enable": false,
"certPath": "/var/www/html/MaarchParapheur/samples/certs/MP_final_certificate.crt",
......
......@@ -37,12 +37,8 @@ class DatabasePDO
throw new \Exception('Configuration file can not be read');
}
$databases = array_filter($loaderJson, function($value, $key) {
return strpos($key, 'database') !== false;
}, ARRAY_FILTER_USE_BOTH);
$count = 1;
foreach ($databases as $key => $database) {
foreach ($loaderJson['databases'] as $key => $database) {
$server = $database['server'];
$port = $database['port'];
$name = $database['name'];
......@@ -84,8 +80,7 @@ class DatabasePDO
self::$pdo = new \PDO($dsn, $user, $password, $options);
break;
} catch (\PDOException $PDOException) {
if (!empty($loaderJson[$key . $count])) {
$count++;
if (!empty($loaderJson['databases'][$key + 1])) {
continue;
} else {
throw new \Exception($PDOException->getMessage());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment