From 1d54c7f8360405c9b707d5201612b8a0a25fa241 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 12 Sep 2014 10:42:48 +0200 Subject: [PATCH] monitoring/commands: Support 'DISABLE_NOTIFICATIONS_EXPIRE_TIME' refs #6593 --- .../Instance/DisableNotificationsExpireCommandForm.php | 2 +- .../Renderer/IcingaCommandFileCommandRenderer.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php index 08b1f1813..4ebe83c58 100644 --- a/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php +++ b/modules/monitoring/application/forms/Command/Instance/DisableNotificationsExpireCommandForm.php @@ -66,7 +66,7 @@ class DisableNotificationsExpireCommandForm extends CommandForm { $disableNotifications = new DisableNotificationsExpireCommand(); $disableNotifications - ->setExpireTime($this->getElement('expire_time')->getValue()); + ->setExpireTime($this->getElement('expire_time')->getValue()->getTimestamp()); $this->getTransport($request)->send($disableNotifications); Notification::success(mt('monitoring', 'Disabling host and service notifications..')); return true; diff --git a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php index 5045a8ade..ce813b7a2 100644 --- a/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php +++ b/modules/monitoring/library/Monitoring/Command/Renderer/IcingaCommandFileCommandRenderer.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Monitoring\Command\Renderer; +use Icinga\Module\Monitoring\Command\Instance\DisableNotificationsExpireCommand; use Icinga\Module\Monitoring\Command\Object\AcknowledgeProblemCommand; use Icinga\Module\Monitoring\Command\Object\AddCommentCommand; use Icinga\Module\Monitoring\Command\Object\DeleteCommentCommand; @@ -386,4 +387,13 @@ class IcingaCommandFileCommandRenderer implements IcingaCommandRendererInterface } return $commandString; } + + public function renderDisableNotificationsExpire(DisableNotificationsExpireCommand $command) + { + return sprintf( + '%s;%u', + 'DISABLE_NOTIFICATIONS_EXPIRE_TIME', + $command->getExpireTime() + ); + } }