[icinga-checkins] icinga.org: icingaweb2-module-director/master: Db: add countActivitiesSinceLastDeployedConfig

git at icinga.org git at icinga.org
Thu Feb 18 13:46:59 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: ea8da2172f360d680b86394a0af670f5c264a9bb
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=ea8da2172f360d680b86394a0af670f5c264a9bb

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Feb 18 13:46:24 2016 +0100

Db: add countActivitiesSinceLastDeployedConfig

Forgot to push this one, sorry.

---

 library/Director/Db.php |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/library/Director/Db.php b/library/Director/Db.php
index adaafe4..4432b9c 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -24,6 +24,19 @@ class Db extends DbConnection
         return $this->getDbAdapter();
     }
 
+    public function countActivitiesSinceLastDeployedConfig()
+    {
+        $query = 'SELECT COUNT(*) FROM director_activity_log WHERE id > ('
+            . ' SELECT id FROM director_activity_log WHERE checksum = ('
+            . '  SELECT last_activity_checksum FROM director_generated_config WHERE checksum = ('
+            . '   SELECT config_checksum FROM director_deployment_log ORDER by id desc limit 1'
+            . '  )'
+            . ' )'
+            . ')';
+
+        return (int) $this->db()->fetchOne($query);
+    }
+
     public function getMasterZoneName()
     {
         return $this->getSetting('master_zone', 'master');



More information about the icinga-checkins mailing list