IcingaConfig: add static exists() helper

This commit is contained in:
Thomas Gelf 2016-06-16 15:48:54 +02:00
parent cf88f110e0
commit 734c7c7b02
1 changed files with 14 additions and 0 deletions

View File

@ -132,6 +132,20 @@ class IcingaConfig
return $config;
}
public static function exists($checksum, Db $connection)
{
$db = $connnection->getDbAdapter();
$query = $db->select()->from(
array('c' => self::$table),
array('checksum' => $connection->dbHexFunc('c.checksum'))
)->where(
'checksum = ?',
$connection->quoteBinary(Util::hex2binary($checksum))
);
return $db->fetchOne($query) === $checksum;
}
public static function loadByActivityChecksum($checksum, Db $connection)
{
$db = $connection->getDbAdapter();