Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
centreon
centreon
Commits
074e735c
Unverified
Commit
074e735c
authored
May 01, 2020
by
Kevin Duret
Committed by
GitHub
May 01, 2020
Browse files
Update generateSqlLite
parent
e8673cba
Changes
1
Hide whitespace changes
Inline
Side-by-side
bin/generateSqlLite
View file @
074e735c
...
...
@@ -395,20 +395,24 @@ try {
}
// Insert direct services
$insertedHostServiceRelation
=
array
()
;
$insertedServices
=
array
()
;
$insertedHostServiceRelation
=
[]
;
$insertedServices
=
[]
;
foreach
(
$result_host_services
as
$value
)
{
if
(
!
isset
(
$insertedHostServiceRelation
[
$value
[
'service_id'
]
.
"-"
.
$value
[
'host_id'
]]))
{
if
(
!
isset
(
$insertedServices
[
$value
[
'service_id'
]]))
{
$stmt
=
$dbh_sqlite
->
prepare
(
"INSERT INTO service (service_id, service_description, service_template_model_stm_id) VALUES (
:service_id, :service_description, :service_template_model_stm_id)"
);
$stmt
=
$dbh_sqlite
->
prepare
(
"
INSERT INTO service (service_id, service_description, service_template_model_stm_id)
VALUES (:service_id, :service_description, :service_template_model_stm_id)
"
);
$stmt
->
bindParam
(
':service_id'
,
$value
[
'service_id'
],
PDO
::
PARAM_INT
);
$stmt
->
bindParam
(
':service_description'
,
$value
[
'service_description'
],
PDO
::
PARAM_STR
);
$stmt
->
bindParam
(
':service_template_model_stm_id'
,
$value
[
'service_template_model_stm_id'
],
PDO
::
PARAM_INT
);
$stmt
->
execute
();
$stmt
=
$dbh_sqlite
->
prepare
(
"INSERT INTO extended_service_information (service_service_id, esi_notes) VALUES (
:service_service_id, :esi_notes)"
);
$stmt
=
$dbh_sqlite
->
prepare
(
"INSERT INTO extended_service_information (service_service_id, esi_notes)
VALUES (:service_service_id, :esi_notes)
"
);
$stmt
->
bindParam
(
':service_service_id'
,
$value
[
'service_id'
],
PDO
::
PARAM_INT
);
$stmt
->
bindParam
(
':esi_notes'
,
$value
[
'esi_notes'
],
PDO
::
PARAM_STR
);
$stmt
->
execute
();
...
...
@@ -416,8 +420,10 @@ try {
$insertedServices
[
$value
[
'service_id'
]]
=
true
;
}
$stmt
=
$dbh_sqlite
->
prepare
(
"INSERT INTO host_service_relation (service_service_id, host_host_id) VALUES (
:service_service_id, :host_host_id)"
);
$stmt
=
$dbh_sqlite
->
prepare
(
"
INSERT INTO host_service_relation (service_service_id, host_host_id)
VALUES (:service_service_id, :host_host_id)
"
);
$stmt
->
bindParam
(
':service_service_id'
,
$value
[
'service_id'
],
PDO
::
PARAM_INT
);
$stmt
->
bindParam
(
':host_host_id'
,
$value
[
'host_id'
],
PDO
::
PARAM_INT
);
$stmt
->
execute
();
...
...
@@ -425,6 +431,7 @@ try {
$insertedHostServiceRelation
[
$value
[
'service_id'
]
.
"-"
.
$value
[
'host_id'
]]
=
true
;
}
}
// Insert services by hostgroup
foreach
(
$result_services_from_hg
as
$value
)
{
if
(
!
isset
(
$insertedServices
[
$value
[
'service_id'
]]))
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment