mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-26 11:19:16 +02:00
DirectorActivityLog: improve removal logging
This commit is contained in:
parent
547b13d53f
commit
3e016311d6
@ -80,12 +80,13 @@ class DirectorActivityLog extends DbObject
|
||||
|
||||
public static function logRemoval(DbObject $object, Db $db)
|
||||
{
|
||||
$plain = $object->getCachedUnmodifiedObject();
|
||||
$data = array(
|
||||
'object_name' => $object->object_name,
|
||||
'object_name' => $plain->object_name,
|
||||
'action_name' => 'delete',
|
||||
'author' => self::username(),
|
||||
'object_type' => $object->getTableName(),
|
||||
'old_properties' => json_encode($object->getPlainUnmodifiedObject()),
|
||||
'old_properties' => json_encode($plain),
|
||||
'change_time' => date('Y-m-d H:i:s'), // TODO -> postgres!
|
||||
'parent_checksum' => $db->getLastActivityChecksum()
|
||||
);
|
||||
|
@ -1082,6 +1082,16 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function beforeDelete()
|
||||
{
|
||||
$this->cachedPlainUnmodified = $this->getPlainUnmodifiedObject();
|
||||
}
|
||||
|
||||
public function getCachedUnmodifiedObject()
|
||||
{
|
||||
return $this->cachedPlainUnmodified;
|
||||
}
|
||||
|
||||
public function onDelete()
|
||||
{
|
||||
DirectorActivityLog::logRemoval($this, $this->connection);
|
||||
@ -1650,6 +1660,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function getOnDeleteUrl()
|
||||
{
|
||||
return 'director/' . strtolower($this->getShortTableName()) . 's';
|
||||
}
|
||||
|
||||
public function toJson(
|
||||
$resolved = false,
|
||||
$skipDefaults = false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user