mirror of https://github.com/Icinga/icinga2.git
DB IDO: Ensure to delete outdated comments/downtimes for host/service objects
fixes #11688
This commit is contained in:
parent
88dff68567
commit
0ce41399e0
|
@ -303,11 +303,11 @@ void DbEvents::AddComments(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
std::set<Comment::Ptr> comments = checkable->GetComments();
|
std::set<Comment::Ptr> comments = checkable->GetComments();
|
||||||
|
|
||||||
if (comments.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::vector<DbQuery> queries;
|
std::vector<DbQuery> queries;
|
||||||
|
|
||||||
|
/* Ensure to delete all comments and then insert any or none.
|
||||||
|
* We must purge obsolete comments in the database at all cost. */
|
||||||
|
|
||||||
DbQuery query1;
|
DbQuery query1;
|
||||||
query1.Table = "comments";
|
query1.Table = "comments";
|
||||||
query1.Type = DbQueryDelete;
|
query1.Type = DbQueryDelete;
|
||||||
|
@ -442,8 +442,8 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
std::set<Downtime::Ptr> downtimes = checkable->GetDowntimes();
|
std::set<Downtime::Ptr> downtimes = checkable->GetDowntimes();
|
||||||
|
|
||||||
if (downtimes.empty())
|
/* Ensure to delete all downtimes and then insert any or none.
|
||||||
return;
|
* We must purge obsolete downtimes in the database at all cost. */
|
||||||
|
|
||||||
std::vector<DbQuery> queries;
|
std::vector<DbQuery> queries;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue