From ea8da2172f360d680b86394a0af670f5c264a9bb Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 18 Feb 2016 13:46:24 +0100 Subject: [PATCH] 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 adaafe4d..4432b9c0 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');