Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchParapheur
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchParapheur
Commits
ded52c26
Commit
ded52c26
authored
2 years ago
by
Jean-Laurent DUZANT
Committed by
Guillaume Heurtier
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #23832 TIME 0:20 manage database redondant
parent
c0205c57
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/config.default.json
+10
-8
10 additions, 8 deletions
config/config.default.json
src/core/models/DatabasePDO.php
+2
-7
2 additions, 7 deletions
src/core/models/DatabasePDO.php
with
12 additions
and
15 deletions
config/config.default.json
+
10
−
8
View file @
ded52c26
...
...
@@ -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"
,
...
...
This diff is collapsed.
Click to expand it.
src/core/models/DatabasePDO.php
+
2
−
7
View file @
ded52c26
...
...
@@ -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
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment