parent
623dd1cbc7
commit
fb10bac7e9
|
@ -23,6 +23,7 @@ This version hasn't been released yet
|
||||||
|
|
||||||
### Import and Sync
|
### Import and Sync
|
||||||
* FEATURE: regular expression based modifier allows explicit NULL on no match (#2705)
|
* FEATURE: regular expression based modifier allows explicit NULL on no match (#2705)
|
||||||
|
* FIX: synchronizing Service (and -Set) Templates has been fixed (#2745, #2217)
|
||||||
|
|
||||||
### Permissions and Restrictions
|
### Permissions and Restrictions
|
||||||
* FIX: monitoring-related permission checks have been refactored (#2712)
|
* FIX: monitoring-related permission checks have been refactored (#2712)
|
||||||
|
|
|
@ -452,7 +452,28 @@ class Sync
|
||||||
if ($this->store) {
|
if ($this->store) {
|
||||||
$objects = $this->store->loadAll(DbObjectTypeRegistry::tableNameByType($ruleObjectType), 'object_name');
|
$objects = $this->store->loadAll(DbObjectTypeRegistry::tableNameByType($ruleObjectType), 'object_name');
|
||||||
} else {
|
} else {
|
||||||
$objects = IcingaObject::loadAllByType($ruleObjectType, $this->db);
|
$keyColumn = null;
|
||||||
|
$query = null;
|
||||||
|
// We enforce named index for combined-key templates (Services and Sets) and applied Sets
|
||||||
|
if ($ruleObjectType === 'service' || $ruleObjectType === 'serviceSet') {
|
||||||
|
foreach ($this->syncProperties as $prop) {
|
||||||
|
$configuredObjectType = $prop->get('source_expression');
|
||||||
|
if ($prop->get('destination_field') === 'object_type'
|
||||||
|
&& (
|
||||||
|
$configuredObjectType === 'template'
|
||||||
|
|| ($configuredObjectType === 'apply' && $ruleObjectType === 'serviceSet')
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$keyColumn = 'object_name';
|
||||||
|
$table = $ruleObjectType === 'service'
|
||||||
|
? BranchSupport::TABLE_ICINGA_SERVICE
|
||||||
|
: BranchSupport::TABLE_ICINGA_SERVICE_SET;
|
||||||
|
$query = $this->db->getDbAdapter()->select()
|
||||||
|
->from($table)->where('object_type = ?', $configuredObjectType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$objects = IcingaObject::loadAllByType($ruleObjectType, $this->db, $query, $keyColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($useLowerCaseKeys) {
|
if ($useLowerCaseKeys) {
|
||||||
|
|
|
@ -2662,16 +2662,16 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
/** @var DbObject $class */
|
/** @var DbObject $class */
|
||||||
$class = DbObjectTypeRegistry::classByType($type);
|
$class = DbObjectTypeRegistry::classByType($type);
|
||||||
|
|
||||||
|
if ($keyColumn === null && is_array($class::create()->getKeyName())) {
|
||||||
|
return $class::loadAll($db, $query);
|
||||||
|
}
|
||||||
|
|
||||||
if ($keyColumn === null) {
|
if ($keyColumn === null) {
|
||||||
if (method_exists($class, 'getKeyColumnName')) {
|
if (method_exists($class, 'getKeyColumnName')) {
|
||||||
$keyColumn = $class::getKeyColumnName();
|
$keyColumn = $class::getKeyColumnName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($class::create()->getKeyName())) {
|
|
||||||
return $class::loadAll($db, $query);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PrefetchCache::shouldBeUsed()
|
if (PrefetchCache::shouldBeUsed()
|
||||||
&& $query === null
|
&& $query === null
|
||||||
&& $keyColumn === static::getKeyColumnName()
|
&& $keyColumn === static::getKeyColumnName()
|
||||||
|
|
Loading…
Reference in New Issue