From 97b81e08d1f9155c52c3d8977dd9537362b890c6 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 24 Feb 2016 11:08:30 +0100 Subject: [PATCH] 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 4432b9c0..e9cb2427 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') {