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

git at icinga.org git at icinga.org
Wed Feb 24 11:09:30 CET 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Feb 24 11:08:30 2016 +0100

Db: add fetchActivityLogChecksumById method

---

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

diff --git a/library/Director/Db.php b/library/Director/Db.php
index 4432b9c..e9cb242 100644
--- a/library/Director/Db.php
+++ b/library/Director/Db.php
@@ -179,6 +179,21 @@ class Db extends DbConnection
         return $this->db()->fetchRow($sql);
     }
 
+    public function fetchActivityLogChecksumById($id, $binary = true)
+    {
+        $sql = 'SELECT checksum FROM director_activity_log WHERE id = ' . (int) $id;
+        $result = $this->db()->fetchOne($sql);
+        if (is_resource($result)) {
+            $result = stream_get_contents($result);
+        }
+
+        if ($binary) {
+            return $result;
+        } else {
+            return bin2hex($result);
+        }
+    }
+
     public function fetchActivityLogEntry($checksum)
     {
         if ($this->getDbType() === 'pgsql') {



More information about the icinga-checkins mailing list