mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
IcingaServiceSetTable: do not trust a Servicve Set
...name, as the Template might have been renamed in the meantime - and the name on the Set "object" has no meaning at all fixes #1664
This commit is contained in:
parent
ea18006819
commit
33053103e1
@ -165,14 +165,24 @@ class IcingaServiceSetServiceTable extends ZfQueryBasedTable
|
|||||||
'name' => $this->host->getObjectName()
|
'name' => $this->host->getObjectName()
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
$hostId = $this->host->get('id');
|
$deleteLink->runOnSuccess(function () {
|
||||||
$setName = $this->set->getObjectName();
|
$conn = $this->set->getConnection();
|
||||||
$db = $this->set->getConnection();
|
$db = $conn->getDbAdapter();
|
||||||
$deleteLink->runOnSuccess(function () use ($db, $hostId, $setName) {
|
$query = $db->select()->from(
|
||||||
IcingaServiceSet::load([
|
['ss' => 'icinga_service_set'],
|
||||||
'host_id' => $hostId,
|
'ss.id'
|
||||||
'object_name' => $setName
|
)->join(
|
||||||
], $db)->delete();
|
['ssih' => 'icinga_service_set_inheritance'],
|
||||||
|
'ssih.service_set_id = ss.id',
|
||||||
|
[]
|
||||||
|
)->where(
|
||||||
|
'ssih.parent_service_set_id = ?',
|
||||||
|
$this->set->get('id')
|
||||||
|
)->where('ss.host_id = ?', $this->host->get('id'));
|
||||||
|
IcingaServiceSet::loadWithAutoIncId(
|
||||||
|
$db->fetchOne($query),
|
||||||
|
$conn
|
||||||
|
)->delete();
|
||||||
});
|
});
|
||||||
$deleteLink->handleRequest();
|
$deleteLink->handleRequest();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user