From f66ab8dae2f3d0418759f81a3a64dc9517a62449 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:17:31 +0200 Subject: Adding upstream version 1.10.2. Signed-off-by: Daniel Baumann --- library/Director/Deployment/DeploymentInfo.php | 59 ++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 library/Director/Deployment/DeploymentInfo.php (limited to 'library/Director/Deployment/DeploymentInfo.php') diff --git a/library/Director/Deployment/DeploymentInfo.php b/library/Director/Deployment/DeploymentInfo.php new file mode 100644 index 0000000..77d52de --- /dev/null +++ b/library/Director/Deployment/DeploymentInfo.php @@ -0,0 +1,59 @@ +db = $db; + } + + public function setObject(IcingaObject $object) + { + $this->object = $object; + return $this; + } + + public function getTotalChanges() + { + if ($this->totalChanges === null) { + $this->totalChanges = $this->db->countActivitiesSinceLastDeployedConfig(); + } + + return $this->totalChanges; + } + + public function getSingleObjectChanges() + { + if ($this->objectChanges === null) { + if ($this->object === null) { + $this->objectChanges = 0; + } else { + $this->objectChanges = $this->db + ->countActivitiesSinceLastDeployedConfig($this->object); + } + } + + return $this->objectChanges; + } + + public function hasUndeployedChanges() + { + return $this->getSingleObjectChanges() > 0 && $this->getTotalChanges() > 0; + } +} -- cgit v1.2.3