Db: add fetchActivityLogChecksumById method

This commit is contained in:
Thomas Gelf 2016-02-24 11:08:30 +01:00
parent 42e87476fb
commit 97b81e08d1
1 changed files with 15 additions and 0 deletions

View File

@ -179,6 +179,21 @@ class Db extends DbConnection
return $this->db()->fetchRow($sql); 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) public function fetchActivityLogEntry($checksum)
{ {
if ($this->getDbType() === 'pgsql') { if ($this->getDbType() === 'pgsql') {